EvaFileThread::EvaFileThread(TQObject *receiver, const unsigned int id, const TQValueList<TQString> &dirList, const TQValueList<TQString> &filenameList, const TQValueList<unsigned int> sizeList, const bool isSender) : TQObject(), TQThread(), m_IsSender(isSender), m_Receiver(receiver), m_Id(id), m_Session(0), m_StartOffset(0), m_ExitNow(false), m_BytesSent(0), m_File(NULL), m_Connecter(NULL) { if(dirList.size() != filenameList.size()) { m_ExitNow = true; return; } m_DirList = dirList; m_FileNameList = filenameList; m_SizeList = sizeList; EvaCachedFile *file; for(unsigned int i = 0; i < dirList.size(); ++i){ printf("EvaFileThread::EvaFileThread -- dir: %s\t filename:%s\n", dirList[i].ascii(), filenameList[i].ascii()); if(m_IsSender) file = new EvaCachedFile(dirList[i], filenameList[i]); else file = new EvaCachedFile(dirList[i], filenameList[i], sizeList[i]); m_FileList.append(file); } m_FileList.setAutoDelete(true); m_File = m_FileList.first(); m_Dir = dirList.first(); m_FileName = filenameList.first(); }
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); } }
void QuickLauncher::loadConfig() { DEBUGSTR << "QuickLauncher::loadConfig()" << endl << flush; //TDEConfig *c = config(); //c->setGroup("General"); setConserveSpace(m_settings->conserveSpace()); setDragEnabled(m_settings->dragEnabled()); /*DEBUGSTR << " IconDim="<<m_iconDim << endl << flush; DEBUGSTR << " ConserveSpace=" << (m_manager->conserveSpace()) << endl << flush; DEBUGSTR << " DragEnabled=" << isDragEnabled() << endl << flush;*/ TQStringList volatileButtons = m_settings->volatileButtons(); TQStringList urls = m_settings->buttons(); if (m_settings->showDesktopEnabled()) { if (!urls.contains("SPECIAL_BUTTON__SHOW_DESKTOP")) urls.prepend("SPECIAL_BUTTON__SHOW_DESKTOP"); } else { if (urls.contains("SPECIAL_BUTTON__SHOW_DESKTOP")) urls.remove("SPECIAL_BUTTON__SHOW_DESKTOP"); } kdDebug() << "GetButtons " << urls.join("/") << endl; TQStringList::Iterator iter(urls.begin()); int n = 0; while (iter != urls.end()) { TQString url = *iter; addApp(url, n, false); ++iter; ++n; } // Restore sticky state for (n=0; n<int(m_buttons->size()); ++n) { QuickButton* button = (*m_buttons)[n]; if (volatileButtons.contains(button->menuId()) == false) { button->setSticky(true); } button->setDynamicModeEnabled(m_settings->autoAdjustEnabled()); } m_popularity->readConfig(m_settings); m_popularity->setHistoryHorizon(m_settings->historyHorizon()/100.0); TQStringList serviceNames = m_settings->serviceNames(); TQValueList<int> insPos = m_settings->serviceInspos(); for (int n=std::min(serviceNames.size(),insPos.size())-1; n>=0; --n) { m_appOrdering[serviceNames[n]] = insPos[n]; } }
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 ); } }
void EvaServers::getResultsSlot( ) { TQDns *dns = (TQDns *)(TQObject::sender()); if(dns == 0 ){ defaultAddress(); return; } TQValueList<TQHostAddress> list = dns->addresses(); if(list.count() == 0 ){ defaultAddress(); return; } TQHostAddress addr = list[0]; kdDebug() << "[DNS reply] " << dns->label() << " ---> " << addr.toString() << endl; emit isReady(addr); }
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; }
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 ); }
void QuickLauncher::saveConfig() { if (!m_refreshEnabled) { m_needsSave=true; return; } TQStringList urls, volatileUrls; ButtonIter iter = m_buttons->begin(); while (iter != m_buttons->end()) { if ((*iter)->sticky() == false) { volatileUrls.append((*iter)->menuId()); } urls.append((*iter)->menuId()); ++iter; } m_settings->setButtons(urls); kdDebug() << "SetButtons " << urls.join("/") << endl; m_settings->setVolatileButtons(volatileUrls); m_settings->setConserveSpace(m_manager->conserveSpace()); m_settings->setDragEnabled(isDragEnabled()); m_popularity->writeConfig(m_settings); // m_popularity must have written the current service list by now TQStringList serviceNames = m_settings->serviceNames(); TQValueList<int> insertionPositions; for (int n=0; n<int(serviceNames.size()); ++n) { if (m_appOrdering.find(serviceNames[n]) != m_appOrdering.end()) { insertionPositions.push_back(m_appOrdering[serviceNames[n]]); } } m_settings->setServiceInspos(insertionPositions); m_settings->writeConfig(); }
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 ); }
TQRect ExtensionManager::workArea(int XineramaScreen, const ExtensionContainer* extension) { if (!extension) { return Kicker::the()->twinModule()->workArea(XineramaScreen); } TQValueList<WId> list; ExtensionList::iterator itEnd = _containers.end(); ExtensionList::iterator it = _containers.begin(); // If the hide mode is Manual, exclude the struts of // panels below this one in the list. Else exclude the // struts of all panels. if (extension->reserveStrut() && extension != m_menubarPanel && extension->hideMode() == ExtensionContainer::ManualHide) { if (m_mainPanel && shouldExclude(XineramaScreen, extension, m_mainPanel)) { list.append(m_mainPanel->winId()); } for (; it != itEnd; ++it) { if (shouldExclude(XineramaScreen, extension, *it)) { list.append((*it)->winId()); } } } else { // auto hide panel? just ignore everything else for now. if (extension == m_menubarPanel) { list.append(m_menubarPanel->winId()); } if (m_mainPanel) { list.append(m_mainPanel->winId()); } for (; it != itEnd; ++it) { list.append((*it)->winId()); } } TQRect workArea; if ((XineramaScreen == XineramaAllScreens) || (kapp->desktop()->numScreens() < 2)) { /* special value for all screens */ workArea = Kicker::the()->twinModule()->workArea(list); } else { workArea = Kicker::the()->twinModule()->workArea(list, XineramaScreen) .intersect(TQApplication::desktop()->screenGeometry(XineramaScreen)); } return workArea; }
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); } }
bool TDERootSystemDevice::canHibernate() { // Network file systems mounted on $HOME typically cause nasty suspend/resume failures // See Bug 1615 for details if (isNetworkFileSystem(TDEStorageDevice::determineFileSystemType(TDEGlobal::dirs()->localtdedir()))) { return FALSE; } TQString statenode = "/sys/power/state"; int rval = access (statenode.ascii(), W_OK); if (rval == 0) { if (powerStates().contains(TDESystemPowerState::Hibernate)) { return TRUE; } else { return FALSE; } } #ifdef WITH_UPOWER { TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); if (dbusConn.isConnected()) { TQT_DBusProxy upowerProperties("org.freedesktop.UPower", "/org/freedesktop/UPower", "org.freedesktop.DBus.Properties", dbusConn); if (upowerProperties.canSend()) { // can hibernate? TQValueList<TQT_DBusData> params; params << TQT_DBusData::fromString(upowerProperties.interface()) << TQT_DBusData::fromString("CanHibernate"); TQT_DBusMessage reply = upowerProperties.sendWithReply("Get", params); if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { return reply[0].toVariant().value.toBool(); } } } } #endif// WITH_UPOWER #ifdef WITH_DEVKITPOWER { TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); if (dbusConn.isConnected()) { TQT_DBusProxy devkitpowerProperties("org.freedesktop.DeviceKit.Power", "/org/freedesktop/DeviceKit/Power", "org.freedesktop.DBus.Properties", dbusConn); if (devkitpowerProperties.canSend()) { // can hibernate? TQValueList<TQT_DBusData> params; params << TQT_DBusData::fromString(devkitpowerProperties.interface()) << TQT_DBusData::fromString("CanHibernate"); TQT_DBusMessage reply = devkitpowerProperties.sendWithReply("Get", params); if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { return reply[0].toVariant().value.toBool(); } } } } #endif// WITH_DEVKITPOWER #ifdef WITH_HAL { TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); if (dbusConn.isConnected()) { TQT_DBusProxy halProperties("org.freedesktop.Hal", "/org/freedesktop/Hal/devices/computer", "org.freedesktop.Hal.Device", dbusConn); if (halProperties.canSend()) { // can hibernate? TQValueList<TQT_DBusData> params; TQT_DBusMessage reply; params.clear(); params << TQT_DBusData::fromString("power_management.can_hibernate"); reply = halProperties.sendWithReply("GetPropertyBoolean", params); if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { return reply[0].toBool(); } params.clear(); params << TQT_DBusData::fromString("power_management.can_suspend_to_disk"); reply = halProperties.sendWithReply("GetPropertyBoolean", params); if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { return reply[0].toBool(); } } } } #endif // WITH_HAL #ifdef WITH_TDEHWLIB_DAEMONS { TQT_DBusConnection dbusConn = TQT_DBusConnection::addConnection(TQT_DBusConnection::SystemBus); if (dbusConn.isConnected()) { // can hibernate? TQT_DBusMessage msg = TQT_DBusMessage::methodCall( "org.trinitydesktop.hardwarecontrol", "/org/trinitydesktop/hardwarecontrol", "org.trinitydesktop.hardwarecontrol.Power", "CanHibernate"); TQT_DBusMessage reply = dbusConn.sendWithReply(msg); if (reply.type() == TQT_DBusMessage::ReplyMessage && reply.count() == 1) { return reply[0].toBool(); } } } #endif // WITH_TDEHWLIB_DAEMONS return FALSE; }
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); }
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); }