• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

NepomukDaemons

systray.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE Project
00002    Copyright (c) 2008 Sebastian Trueg <trueg@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016    Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #include "systray.h"
00020 #include "indexscheduler.h"
00021 
00022 #include <KMenu>
00023 #include <KToggleAction>
00024 #include <KLocale>
00025 #include <KCMultiDialog>
00026 #include <KIcon>
00027 
00028 
00029 
00030 Nepomuk::SystemTray::SystemTray( IndexScheduler* scheduler, QWidget* parent )
00031     : KSystemTrayIcon( "nepomuk", parent ),
00032       m_indexScheduler( scheduler )
00033 {
00034     KMenu* menu = new KMenu;
00035     menu->addTitle( i18n( "Strigi File Indexing" ) );
00036 
00037     m_suspendResumeAction = new KToggleAction( i18n( "Suspend Strigi Indexing" ), menu );
00038     m_suspendResumeAction->setCheckedState( KGuiItem( i18n( "Resume Strigi Indexing" ) ) );
00039     m_suspendResumeAction->setToolTip( i18n( "Suspend or resume the Strigi file indexer manually" ) );
00040     connect( m_suspendResumeAction, SIGNAL( toggled( bool ) ),
00041              m_indexScheduler, SLOT( setSuspended( bool ) ) );
00042 
00043     KAction* configAction = new KAction( menu );
00044     configAction->setText( i18n( "Configure Strigi" ) );
00045     configAction->setIcon( KIcon( "configure" ) );
00046     connect( configAction, SIGNAL( triggered() ),
00047              this, SLOT( slotConfigure() ) );
00048 
00049     menu->addAction( m_suspendResumeAction );
00050     menu->addAction( configAction );
00051 
00052     setContextMenu( menu );
00053 
00054     connect( m_indexScheduler, SIGNAL( indexingStarted() ),
00055              this, SLOT( slotUpdateStrigiStatus() ) );
00056     connect( m_indexScheduler, SIGNAL( indexingStopped() ),
00057              this, SLOT( slotUpdateStrigiStatus() ) );
00058     connect( m_indexScheduler, SIGNAL( indexingFolder(QString) ),
00059              this, SLOT( slotUpdateStrigiStatus() ) );
00060 }
00061 
00062 
00063 Nepomuk::SystemTray::~SystemTray()
00064 {
00065 }
00066 
00067 
00068 void Nepomuk::SystemTray::slotUpdateStrigiStatus()
00069 {
00070     bool indexing = m_indexScheduler->isIndexing();
00071     bool suspended = m_indexScheduler->isSuspended();
00072     QString folder = m_indexScheduler->currentFolder();
00073 
00074     if ( suspended )
00075         setToolTip( i18n( "File indexer is suspended" ) );
00076     else if ( indexing )
00077         setToolTip( i18n( "Strigi is currently indexing files in folder %1", folder ) );
00078     else
00079         setToolTip( i18n( "File indexer is idle" ) );
00080 
00081     m_suspendResumeAction->setChecked( suspended );
00082 }
00083 
00084 
00085 void Nepomuk::SystemTray::slotConfigure()
00086 {
00087     KCMultiDialog dlg;
00088     dlg.addModule( "kcm_nepomuk" );
00089     dlg.exec();
00090 }
00091 
00092 #include "systray.moc"

NepomukDaemons

Skip menu "NepomukDaemons"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KCMShell
  • KNotify
  • KStyles
  • Nepomuk Daemons
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal