30 #include <KActionCollection> 
   31 #include <KConfigGroup> 
   33 #include <KIconEffect> 
   34 #include <KIconLoader> 
   36 #include <KMessageBox> 
   38 #include <KStandardAction> 
   39 #include <KToolInvocation> 
   45   KConfigGroup config( KGlobal::config(), 
"General" );
 
   46   const bool autostartSet = config.hasKey( 
"Autostart" );
 
   47   const bool autostart = config.readEntry( 
"Autostart", 
true );
 
   48   const bool alarmsEnabled = config.readEntry( 
"Enabled", 
true );
 
   50   mName = i18nc( 
"@title:window", 
"KOrganizer Reminder Daemon" );
 
   51   setToolTipTitle( mName );
 
   57   QString iconPath = KIconLoader::global()->iconPath( 
QLatin1String(
"korgac"), KIconLoader::Panel );
 
   59   if ( iconEnabled.
isNull() ) {
 
   60     KMessageBox::sorry( associatedWidget(),
 
   61                         i18nc( 
"@info", 
"Cannot load system tray icon." ) );
 
   65       iconEnabled.
pixmap( loader.currentSize( KIconLoader::Panel ) ).toImage();
 
   66     KIconEffect::toGray( iconDisabled, 1.0 );
 
   70   changeSystrayIcon( alarmsEnabled );
 
   74     contextMenu()->addAction( i18nc( 
"@action:inmenu", 
"Suspend All Reminders" ), 
this,
 
   77     contextMenu()->addAction( i18nc( 
"@action:inmenu", 
"Dismiss All Reminders" ), 
this,
 
   82   contextMenu()->addSeparator();
 
   84     contextMenu()->addAction( i18nc( 
"@action:inmenu", 
"Enable Reminders" ) );
 
   89     contextMenu()->addAction( i18nc( 
"@action:inmenu", 
"Start Reminder Daemon at Login" ) );
 
   90   connect( mAutostart, SIGNAL(toggled(
bool)), SLOT(
toggleAutostart(
bool)) );
 
   98   KActionCollection *ac = actionCollection();
 
   99   const char *quitName = KStandardAction::name( KStandardAction::Quit );
 
  102     kDebug() << 
"No Quit standard action.";
 
  104     quit->
disconnect( SIGNAL(triggered(
bool)), 
this, SLOT(maybeQuit()) );
 
  105     connect( quit, SIGNAL(activated()), SLOT(
slotQuit()) );
 
  108   mAutostartSet = autostartSet;
 
  117   const bool actif = ( reminders > 0 );
 
  121     setToolTip( 
QLatin1String(
"korgac"), mName, i18ncp( 
"@info:status",
 
  122                         "There is 1 active reminder.",
 
  123                         "There are %1 active reminders.", reminders ) );
 
  125     setToolTip( 
QLatin1String(
"korgac"), mName, i18nc( 
"@info:status", 
"No active reminders." ) );
 
  131   changeSystrayIcon( checked );
 
  133   KConfigGroup config( KGlobal::config(), 
"General" );
 
  134   config.writeEntry( 
"Enabled", checked );
 
  141   mAutostartSet = 
true;
 
  157   KConfigGroup config( KGlobal::config(), 
"General" );
 
  158   config.writeEntry( 
"Autostart", enable );
 
  170   if ( mAutostartSet == 
true ) {
 
  171     int result = KMessageBox::warningContinueCancel(
 
  174              "Do you want to quit the KOrganizer reminder daemon?<nl/>" 
  175              "<note> you will not get calendar reminders unless the daemon is running.</note>" ),
 
  176       i18nc( 
"@title:window", 
"Close KOrganizer Reminder Daemon" ),
 
  177       KStandardGuiItem::quit() );
 
  179     if ( result == KMessageBox::Continue ) {
 
  183     int result = KMessageBox::questionYesNoCancel(
 
  186              "Do you want to start the KOrganizer reminder daemon at login?<nl/>" 
  187              "<note> you will not get calendar reminders unless the daemon is running.</note>" ),
 
  188       i18nc( 
"@title:window", 
"Close KOrganizer Reminder Daemon" ),
 
  189       KGuiItem( i18nc( 
"@action:button start the reminder daemon", 
"Start" ) ),
 
  190       KGuiItem( i18nc( 
"@action:button do not start the reminder daemon", 
"Do Not Start" ) ),
 
  191       KStandardGuiItem::cancel(),
 
  194     bool autostart = 
true;
 
  195     if ( result == KMessageBox::No ) {
 
  200     if ( result != KMessageBox::Cancel ) {
 
  206 void AlarmDockWindow::changeSystrayIcon( 
bool alarmsEnabled )
 
  208   if ( alarmsEnabled ) {
 
  211     setIconByPixmap( mIconDisabled.
pixmap( 22, 22 ) );
 
virtual void activate(const QPoint &pos)
void slotUpdate(int reminders)
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
void enableAutostart(bool enabled)
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
QPixmap pixmap(const QSize &size, Mode mode, State state) const
void toggleAutostart(bool checked)
QString fromLatin1(const char *str, int size)
void toggleAlarmsEnabled(bool checked)
virtual ~AlarmDockWindow()