LockWidget::LockWidget( const QString &identifier ) { QVBoxLayout *topLayout = new QVBoxLayout( this ); topLayout->setMargin( KDialog::marginHint() ); topLayout->setSpacing( KDialog::spacingHint() ); if ( identifier.isEmpty() ) { mLock = 0; } else { mLock = new Lock( identifier ); int pid = getpid(); QLabel *pidLabel = new QLabel( "Process ID: " + QString::number( pid ), this ); topLayout->addWidget( pidLabel ); QHBoxLayout *identifierLayout = new QHBoxLayout( topLayout ); QLabel *resourceLabel = new QLabel( "Identifier:", this ); identifierLayout->addWidget( resourceLabel ); QLabel *resourceIdentifier = new QLabel( identifier, this ); identifierLayout->addWidget( resourceIdentifier ); mStatus = new QLabel( "Status: Unlocked", this ); topLayout->addWidget( mStatus ); QPushButton *button = new QPushButton( "Lock", this ); topLayout->addWidget( button ); connect( button, SIGNAL( clicked() ), SLOT( lock() ) ); button = new QPushButton( "Unlock", this ); topLayout->addWidget( button ); connect( button, SIGNAL( clicked() ), SLOT( unlock() ) ); } mLockView = new QListView( this ); topLayout->addWidget( mLockView ); mLockView->addColumn( "Lock File" ); mLockView->addColumn( "PID" ); mLockView->addColumn( "Locking App" ); updateLockView(); QPushButton *quitButton = new QPushButton( "Quit", this ); topLayout->addWidget( quitButton ); connect( quitButton, SIGNAL( clicked() ), SLOT( close() ) ); KDirWatch *watch = KDirWatch::self(); connect( watch, SIGNAL( dirty( const QString & ) ), SLOT( updateLockView() ) ); connect( watch, SIGNAL( created( const QString & ) ), SLOT( updateLockView() ) ); connect( watch, SIGNAL( deleted( const QString & ) ), SLOT( updateLockView() ) ); watch->addDir( Lock::locksDir() ); watch->startScan(); }
KateSessionApplet::KateSessionApplet(QObject *parent, const QVariantList &args) : Plasma::PopupApplet(parent, args), m_listView( 0 ), m_config(0) { KDirWatch *dirwatch = new KDirWatch( this ); QStringList lst = KGlobal::dirs()->findDirs( "data", "kate/sessions/" ); for ( int i = 0; i < lst.count(); i++ ) { dirwatch->addDir( lst[i] ); } connect( dirwatch, SIGNAL(dirty (const QString &) ), this, SLOT( slotUpdateSessionMenu() ) ); setPopupIcon( "kate" ); setHasConfigurationInterface(true); }
RecentDocuments::RecentDocuments(QObject *parent, const QVariantList& args) : Plasma::AbstractRunner(parent, args) { Q_UNUSED(args); setObjectName( QStringLiteral("Recent Documents" )); loadRecentDocuments(); // listen for changes to the list of recent documents KDirWatch *recentDocWatch = new KDirWatch(this); recentDocWatch->addDir(KRecentDocument::recentDocumentDirectory(), KDirWatch::WatchFiles); connect(recentDocWatch, &KDirWatch::created, this, &RecentDocuments::loadRecentDocuments); connect(recentDocWatch, &KDirWatch::deleted, this, &RecentDocuments::loadRecentDocuments); connect(recentDocWatch, &KDirWatch::dirty, this, &RecentDocuments::loadRecentDocuments); addSyntax(Plasma::RunnerSyntax(QStringLiteral(":q:"), i18n("Looks for documents recently used with names matching :q:."))); }
KonquerorSessions::KonquerorSessions(QObject *parent, const QVariantList& args) : Plasma::AbstractRunner(parent, args) { Q_UNUSED(args); setObjectName(QLatin1String( "Konqueror Sessions" )); setIgnoredTypes(Plasma::RunnerContext::FileSystem | Plasma::RunnerContext::NetworkLocation); m_icon = KIcon(QLatin1String( "konqueror" )); loadSessions(); KDirWatch *historyWatch = new KDirWatch(this); const QStringList sessiondirs = KGlobal::dirs()->findDirs("data", QLatin1String( "konqueror/profiles/" )); foreach (const QString &dir, sessiondirs) { historyWatch->addDir(dir); }
void ThemesDlg::getNewStuff() { if (!m_newStuffInitialized) { KDirWatch *dirWatch = KDirWatch::self(); connect(dirWatch, SIGNAL(created(QString)), SLOT(installNewTheme(QString))); QString destDir = KStandardDirs::locateLocal("appdata", "themes/"); dirWatch->addDir(destDir, KDirWatch::WatchFiles); m_newStuffInitialized = true; } KNS::Engine::download(); }
RecentDocuments::RecentDocuments(QObject *parent, const QVariantList& args) : Plasma::AbstractRunner(parent, args) { Q_UNUSED(args); setObjectName( QLatin1String("Recent Documents" )); m_icon = QIcon::fromTheme("document-open-recent"); loadRecentDocuments(); // listen for changes to the list of recent documents KDirWatch *recentDocWatch = new KDirWatch(this); recentDocWatch->addDir(KRecentDocument::recentDocumentDirectory(), KDirWatch::WatchFiles); connect(recentDocWatch,SIGNAL(created(QString)),this,SLOT(loadRecentDocuments())); connect(recentDocWatch,SIGNAL(deleted(QString)),this,SLOT(loadRecentDocuments())); connect(recentDocWatch,SIGNAL(dirty(QString)),this,SLOT(loadRecentDocuments())); addSyntax(Plasma::RunnerSyntax(":q:", i18n("Looks for documents recently used with names matching :q:."))); }
KDevelopSessions::KDevelopSessions(QObject *parent, const QVariantList& args) : Plasma::AbstractRunner(parent, args) { kWarning() << "INIT KDEV"; setObjectName(QLatin1String("KDevelop Sessions")); setIgnoredTypes(Plasma::RunnerContext::File | Plasma::RunnerContext::Directory | Plasma::RunnerContext::NetworkLocation); m_icon = KIcon(QLatin1String("kdevelop")); loadSessions(); // listen for changes to the list of kdevelop sessions KDirWatch *historyWatch = new KDirWatch(this); const QStringList sessiondirs = KGlobal::dirs()->findDirs("data", QLatin1String("kdevelop/sessions/")); foreach (const QString &dir, sessiondirs) { historyWatch->addDir(dir); }
Repository::Repository() : QObject() , d(new Private) { d->readGeneralConfig(); new RepositoryAdaptor(this ); QDBusConnection::sessionBus().registerObject("/CvsRepository", this); // other cvsservice instances might change the configuration file // so we watch it for changes d->configFileName = KStandardDirs::locate("config", "cvsservicerc"); KDirWatch* fileWatcher = new KDirWatch(this); connect(fileWatcher, SIGNAL(dirty(QString)), this, SLOT(slotConfigDirty(QString))); fileWatcher->addFile(d->configFileName); }
SourcesModel::SourcesModel(QObject* parent) : QAbstractListModel(parent) , m_size(0) { m_manager = new Plasma::RunnerManager(this); connect(m_manager, SIGNAL(matchesChanged(QList<Plasma::QueryMatch>)), this, SLOT(slotMatchesChanged(QList<Plasma::QueryMatch>))); KDirWatch* watch = KDirWatch::self(); connect(watch, SIGNAL(created(QString)), this, SLOT(reloadConfiguration())); connect(watch, SIGNAL(dirty(QString)), this, SLOT(reloadConfiguration())); watch->addFile(QStandardPaths::locate(QStandardPaths::ConfigLocation, "krunnerrc")); m_resetTimer.setSingleShot(true); m_resetTimer.setInterval(500); connect(&m_resetTimer, SIGNAL(timeout()), this, SLOT(slotResetTimeout())); }
Nepomuk2::FileIndexerConfig::FileIndexerConfig(QObject* parent) : QObject(parent) , m_config( "nepomukstrigirc" ) , m_indexHidden(false) { if(!s_self) { s_self = this; } KDirWatch* dirWatch = KDirWatch::self(); connect( dirWatch, SIGNAL( dirty( const QString& ) ), this, SLOT( slotConfigDirty() ) ); connect( dirWatch, SIGNAL( created( const QString& ) ), this, SLOT( slotConfigDirty() ) ); dirWatch->addFile( KStandardDirs::locateLocal( "config", m_config.name() ) ); forceConfigUpdate(); }
KEmoticonsTheme KEmoticonsPrivate::loadTheme(const QString &name) { const int numberOfTheme = m_loaded.size(); for (int i = 0; i < numberOfTheme; ++i) { const QString fName = m_loaded.at(i)->property("X-KDE-EmoticonsFileName").toString(); const QString path = KGlobal::dirs()->findResource("emoticons", name + '/' + fName); if (QFile::exists(path)) { KEmoticonsProvider *provider = loadProvider(m_loaded.at(i)); KEmoticonsTheme theme(provider); theme.loadTheme(path); m_themes.insert(name, theme); if (!m_dirwatch->contains(path)) { m_dirwatch->addFile(path); } return theme; } } return KEmoticonsTheme(); }
void ApperdThread::init() { connect(PowerManagement::notifier(), SIGNAL(appShouldConserveResourcesChanged(bool)), this, SLOT(appShouldConserveResourcesChanged())); // This timer keeps polling to see if it has // to refresh the cache m_qtimer = new QTimer(this); m_qtimer->setInterval(FIVE_MIN); connect(m_qtimer, SIGNAL(timeout()), this, SLOT(poll())); m_qtimer->start(); //check if any changes to the file occour //this also prevents from reading when a checkUpdate happens KDirWatch *confWatch = new KDirWatch(this); confWatch->addFile(KStandardDirs::locateLocal("config", "apper")); connect(confWatch, SIGNAL(dirty(QString)), this, SLOT(configFileChanged())); connect(confWatch, SIGNAL(created(QString)), this, SLOT(configFileChanged())); connect(confWatch, SIGNAL(deleted(QString)), this, SLOT(configFileChanged())); confWatch->startScan(); // Watch for changes in the KDE proxy settings KDirWatch *proxyWatch = new KDirWatch(this); proxyWatch->addFile(KStandardDirs::locateLocal("config", "kioslaverc")); connect(proxyWatch, SIGNAL(dirty(QString)), this, SLOT(proxyChanged())); connect(proxyWatch, SIGNAL(created(QString)), this, SLOT(proxyChanged())); connect(proxyWatch, SIGNAL(deleted(QString)), this, SLOT(proxyChanged())); proxyWatch->startScan(); QString locale(KGlobal::locale()->language() % QLatin1Char('.') % KGlobal::locale()->encoding()); Daemon::global()->setHints(QLatin1String("locale=") % locale); connect(Daemon::global(), SIGNAL(updatesChanged()), SLOT(updatesChanged())); m_interface = new DBusInterface(this); m_refreshCache = new RefreshCacheTask(this); connect(m_interface, SIGNAL(refreshCache()), m_refreshCache, SLOT(refreshCache())); m_updater = new Updater(this); m_distroUpgrade = new DistroUpgrade(this); // read the current settings configFileChanged(); // In case PackageKit is not running watch for it's registration to configure proxy QDBusServiceWatcher *watcher; watcher = new QDBusServiceWatcher(QLatin1String("org.freedesktop.PackageKit"), QDBusConnection::systemBus(), QDBusServiceWatcher::WatchForRegistration, this); connect(watcher, SIGNAL(serviceRegistered(QString)), SLOT(setProxy())); // if PackageKit is running check to see if there are running transactons already bool packagekitIsRunning = nameHasOwner(QLatin1String("org.freedesktop.PackageKit"), QDBusConnection::systemBus()); m_transactionWatcher = new TransactionWatcher(packagekitIsRunning, this); // connect the watch transaction coming from the updater icon to our watcher connect(m_interface, SIGNAL(watchTransaction(QDBusObjectPath)), m_transactionWatcher, SLOT(watchTransaction(QDBusObjectPath))); // listen to Debian/Apt reboot signals from other sources (apt) connect(m_AptRebootListener, SIGNAL(requestReboot()), m_transactionWatcher, SLOT(showRebootNotificationApt())); QTimer::singleShot(2 /*minutes*/ * 60 /*seconds*/ * 1000 /*msec*/, m_AptRebootListener, SLOT(checkForReboot())); if (packagekitIsRunning) { // PackageKit is running set the session Proxy setProxy(); // If packagekit is already running go check // for updates updatesChanged(); } else { // Initial check for updates QTimer::singleShot(ONE_MIN, this, SLOT(updatesChanged())); } }