Ejemplo n.º 1
0
bool HomeImpl::listHomes(TQValueList<TDEIO::UDSEntry> &list)
{
	kdDebug() << "HomeImpl::listHomes" << endl;

	KUser current_user;
	TQValueList<KUserGroup> groups = current_user.groups();
	TQValueList<int> uid_list;
	
	TQValueList<KUserGroup>::iterator groups_it = groups.begin();
	TQValueList<KUserGroup>::iterator groups_end = groups.end();

	for(; groups_it!=groups_end; ++groups_it)
	{
		TQValueList<KUser> users = (*groups_it).users();

		TQValueList<KUser>::iterator it = users.begin();
		TQValueList<KUser>::iterator users_end = users.end();
		
		for(; it!=users_end; ++it)
		{
			if ((*it).uid()>=MINIMUM_UID
			 && !uid_list.contains( (*it).uid() ) )
			{
				uid_list.append( (*it).uid() );
				TDEIO::UDSEntry entry;
				createHomeEntry(entry, *it);
				list.append(entry);
			}
		}
	}
		
	return true;
}
Ejemplo n.º 2
0
void KMMainView::removePluginActions()
{
	TQValueList<TDEAction*>	pactions = m_actions->actions("plugin");
	for (TQValueList<TDEAction*>::Iterator it=pactions.begin(); it!=pactions.end(); ++it)
	{
		(*it)->unplugAll();
		delete (*it);
	}
}
Ejemplo n.º 3
0
void KMMainView::loadPluginActions()
{
	KMFactory::self()->manager()->createPluginActions(m_actions);
	TQValueList<TDEAction*>	pactions = m_actions->actions("plugin");
	int	index = m_pactionsindex;
	//TQPopupMenu *menu = m_menubar->findItem( m_menubar->idAt( 1 ) )->popup();
	TQPopupMenu *menu = m_menubar->getButton( 1 )->popup();
	for (TQValueList<TDEAction*>::Iterator it=pactions.begin(); it!=pactions.end(); ++it)
	{
		(*it)->plug(m_toolbar, index++);
		( *it )->plug( menu );
	}
}
Ejemplo n.º 4
0
void NotificationDialog::updateActionsListBox()
{
	m_view->actionsList->clear();

	TQValueList<NotifierAction*> actions
		= m_settings->actionsForMimetype( m_medium.mimetype() );

	TQValueList<NotifierAction*>::iterator it = actions.begin();
	TQValueList<NotifierAction*>::iterator end = actions.end();

	for ( ; it!=end; ++it )
	{
		new ActionListBoxItem( *it, m_medium.mimetype(),
		                       m_view->actionsList );
	}

	m_view->actionsList->setSelected( 0, true );
}
Ejemplo n.º 5
0
void ShowDesktop::showDesktop( bool b )
{
    if( b == showingDesktop ) return;
    showingDesktop = b;

    if ( b ) {
        // this code should move to KWin after supporting NETWM1.2
        iconifiedList.clear();
        const TQValueList<WId> windows = kWinModule->windows();
        TQValueList<WId>::ConstIterator it;
        TQValueList<WId>::ConstIterator end( windows.end() );
        for ( it=windows.begin(); it!=end; ++it ) {
            WId w = *it;
            NETWinInfo info( tqt_xdisplay(), w, tqt_xrootwin(),
                             NET::XAWMState | NET::WMDesktop );
            if ( info.mappingState() == NET::Visible &&
                 ( info.desktop() == NETWinInfo::OnAllDesktops
                   || info.desktop() == (int) kWinModule->currentDesktop() )
                ) {
                iconifiedList.append( w );
            }
        }
        // find first, hide later, otherwise transients may get minimized
        // with the window they're transient for
        TQValueList<WId>::ConstIterator endInconifiedList( iconifiedList.end() );
        for ( it=iconifiedList.begin(); it!=endInconifiedList; ++it ) {
            KWin::iconifyWindow( *it, false );
        }
    } else {
        TQValueList<WId>::ConstIterator it;
        TQValueList<WId>::ConstIterator end( iconifiedList.end() );
        for ( it=iconifiedList.begin(); it!=end; ++it ) {
            KWin::deIconifyWindow( *it, false  );
        }
    }

    emit desktopShown( showingDesktop );
}
Ejemplo n.º 6
0
void KWindowListMenu::init()
{
    int i, d;
    i = 0;

    int nd = twin_module->numberOfDesktops();
    int cd = twin_module->currentDesktop();
    WId active_window = twin_module->activeWindow();

    // Make sure the popup is not too wide, otherwise clicking in the middle of kdesktop
    // wouldn't leave any place for the popup, and release would activate some menu entry.    
    int maxwidth = kapp->desktop()->screenGeometry( this ).width() / 2 - 100;

    clear();
    map.clear();

    int unclutter = insertItem( i18n("Unclutter Windows"),
                                this, TQT_SLOT( slotUnclutterWindows() ) );
    int cascade = insertItem( i18n("Cascade Windows"),
                              this, TQT_SLOT( slotCascadeWindows() ) );

    // if we only have one desktop we won't be showing titles, so put a separator in
    if (nd == 1)
    {
        insertSeparator();
    }


    TQValueList<KWin::WindowInfo> windows;
    for (TQValueList<WId>::ConstIterator it = twin_module->windows().begin();
         it != twin_module->windows().end(); ++it) {
         windows.append( KWin::windowInfo( *it, NET::WMDesktop ));
    }
    bool show_all_desktops_group = ( nd > 1 );
    for (d = 1; d <= nd + (show_all_desktops_group ? 1 : 0); d++) {
        bool on_all_desktops = ( d > nd );
	int items = 0;

	if (!active_window && d == cd)
	    setItemChecked(1000 + d, true);

        NameSortedInfoList list;
        list.setAutoDelete(true);

	for (TQValueList<KWin::WindowInfo>::ConstIterator it = windows.begin();
             it != windows.end(); ++it) {
	    if (((*it).desktop() == d) || (on_all_desktops && (*it).onAllDesktops())
                || (!show_all_desktops_group && (*it).onAllDesktops())) {
	        list.inSort(new KWin::WindowInfo( (*it).win(),
                    NET::WMVisibleName | NET::WMState | NET::XAWMState | NET::WMWindowType,
                    NET::WM2GroupLeader | NET::WM2TransientFor ));
            }
        }

        for (KWin::WindowInfo* info = list.first(); info; info = list.next(), ++i)
        {
            TQString itemText = KStringHandler::cPixelSqueeze(info->visibleNameWithState(), fontMetrics(), maxwidth);
            NET::WindowType windowType = info->windowType( NET::NormalMask | NET::DesktopMask
                | NET::DockMask | NET::ToolbarMask | NET::MenuMask | NET::DialogMask
                | NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask );
            if ( (windowType == NET::Normal || windowType == NET::Unknown
                    || (windowType == NET::Dialog && standaloneDialog( info, list )))
                && !(info->state() & NET::SkipTaskbar) ) {
                TQPixmap pm = KWin::icon(info->win(), 16, 16, true );
                items++;

                // ok, we have items on this desktop, let's show the title
                if ( items == 1 && nd > 1 )
                {
                    if( !on_all_desktops )
                        insertTitle(twin_module->desktopName( d ), 1000 + d);
                    else
                        insertTitle(i18n("On All Desktops"), 2000 );
                }

                // Avoid creating unwanted accelerators.
                itemText.replace('&', TQString::fromLatin1("&&"));
                insertItem( pm, itemText, i);
                map.insert(i, info->win());
                if (info->win() == active_window)
                    setItemChecked(i, true);
            }
        }

        if (d == cd)
        {
            setItemEnabled(unclutter, items > 0);
            setItemEnabled(cascade, items > 0);
        }
    }

    // no windows?
    if (i == 0)
    {
        if (nd > 1)
        {
            // because we don't have any titles, nor a separator
            insertSeparator();
        }

        setItemEnabled(insertItem(i18n("No Windows")), false);
    }
}
Ejemplo n.º 7
0
void ShowDesktop::showDesktop( bool b )
{
    if (b == m_showingDesktop)
    {
        return;
    }
    
    if( m_wmSupport )
    {
        NETRootInfo i( tqt_xdisplay(), 0 );
        i.setShowingDesktop( b );
        return;
    }

    if (b)
    {
        m_activeWindow = Kicker::the()->twinModule()->activeWindow();
        m_iconifiedList.clear();

        const TQValueList<WId> windows = Kicker::the()->twinModule()->windows();
        for (TQValueList<WId>::ConstIterator it = windows.begin();
             it != windows.end();
             ++it)
        {
            WId w = *it;

            NETWinInfo info( tqt_xdisplay(), w, tqt_xrootwin(),
                             NET::XAWMState | NET::WMDesktop );

            if (info.mappingState() == NET::Visible &&
                (info.desktop() == NETWinInfo::OnAllDesktops ||
                 info.desktop() == (int)Kicker::the()->twinModule()->currentDesktop()))
            {
                m_iconifiedList.append( w );
            }
        }

        // find first, hide later, otherwise transients may get minimized
        // with the window they're transient for
        for (TQValueVector<WId>::Iterator it = m_iconifiedList.begin();
             it != m_iconifiedList.end();
             ++it)
        {
            KWin::iconifyWindow( *it, false );
        }

        // on desktop changes or when a window is deiconified, we abort the show desktop mode
        connect(Kicker::the()->twinModule(), TQT_SIGNAL(currentDesktopChanged(int)),
                TQT_SLOT(slotCurrentDesktopChanged(int)));
        connect(Kicker::the()->twinModule(), TQT_SIGNAL(windowChanged(WId,unsigned int)),
                TQT_SLOT(slotWindowChanged(WId,unsigned int)));
        connect(Kicker::the()->twinModule(), TQT_SIGNAL(windowAdded(WId)),
                TQT_SLOT(slotWindowAdded(WId)));
    }
    else
    {
        disconnect(Kicker::the()->twinModule(), TQT_SIGNAL(currentDesktopChanged(int)),
                   this, TQT_SLOT(slotCurrentDesktopChanged(int)));
        disconnect(Kicker::the()->twinModule(), TQT_SIGNAL(windowChanged(WId,unsigned int)),
                   this, TQT_SLOT(slotWindowChanged(WId,unsigned int)));
        disconnect(Kicker::the()->twinModule(), TQT_SIGNAL(windowAdded(WId)),
                   this, TQT_SLOT(slotWindowAdded(WId)));

        for (TQValueVector<WId>::ConstIterator it = m_iconifiedList.begin();
             it != m_iconifiedList.end();
             ++it)
        {
            KWin::deIconifyWindow(*it, false);
        }

        KWin::forceActiveWindow(m_activeWindow);
    }

    m_showingDesktop = b;
    emit desktopShown(m_showingDesktop);
}
Ejemplo n.º 8
0
void KMMainView::slotRightButtonClicked(const TQString& prname, const TQPoint& p)
{
	KMPrinter	*printer = KMManager::self()->findPrinter(prname);
	// construct popup menu
	m_pop->clear();
	if (printer)
	{
		m_current = printer;
		if (!printer->isSpecial())
		{
			if (printer->isLocal())
				m_actions->action((printer->state() == KMPrinter::Stopped ? "printer_start" : "printer_stop"))->plug(m_pop);
			m_actions->action((printer->acceptJobs() ? "printer_disable" : "printer_enable"))->plug(m_pop);
			m_pop->insertSeparator();
		}
		if (!printer->isSoftDefault()) m_actions->action("printer_soft_default")->plug(m_pop);
		if (printer->isLocal() && !printer->isImplicit())
		{
			if (!printer->isHardDefault()) m_actions->action("printer_hard_default")->plug(m_pop);
			m_actions->action("printer_remove")->plug(m_pop);
			m_pop->insertSeparator();
			if (!printer->isClass(true))
			{
				m_actions->action("printer_configure")->plug(m_pop);
				m_actions->action("printer_test")->plug(m_pop);
				m_actions->action("printer_tool")->plug(m_pop);
				m_pop->insertSeparator();
			}
		}
		else
		{
			m_actions->action("printer_remove")->plug(m_pop);
			m_pop->insertSeparator();
			if (!printer->isClass(true))
			{
				m_actions->action("printer_configure")->plug(m_pop);
				m_actions->action("printer_test")->plug(m_pop);
			}
			m_pop->insertSeparator();
		}
		if (!printer->isSpecial())
		{
			TQValueList<TDEAction*>	pactions = m_actions->actions("plugin");
			for (TQValueList<TDEAction*>::Iterator it=pactions.begin(); it!=pactions.end(); ++it)
				(*it)->plug(m_pop);
			if (pactions.count() > 0)
				m_pop->insertSeparator();
		}
	}
	else
	{
		m_actions->action("printer_add")->plug(m_pop);
		m_actions->action("printer_add_special")->plug(m_pop);
		m_pop->insertSeparator();
		m_actions->action("server_restart")->plug(m_pop);
		m_actions->action("server_configure")->plug(m_pop);
		m_pop->insertSeparator();
		m_actions->action("manager_configure")->plug(m_pop);
		m_actions->action("view_refresh")->plug(m_pop);
		m_pop->insertSeparator();
	}
	m_actions->action("view_printerinfos")->plug(m_pop);
	m_actions->action("view_change")->plug(m_pop);
	m_actions->action("orientation_change")->plug(m_pop);
	m_actions->action("view_toolbar")->plug(m_pop);
	m_actions->action("view_menubar")->plug(m_pop);
	m_pop->insertSeparator();
	m_actions->action("view_pfilter")->plug(m_pop);

	// pop the menu
	m_pop->popup(p);
}