korganizer

alarmdialog.cpp

00001 /*
00002     This file is part of the KOrganizer alarm daemon.
00003 
00004     Copyright (c) 2000,2003 Cornelius Schumacher <schumacher@kde.org>
00005     Copyright (c) 2009-2010 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or
00010     (at your option) any later version.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License
00018     along with this program; if not, write to the Free Software
00019     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020 
00021     As a special exception, permission is given to link this program
00022     with any edition of Qt, and distribute the resulting executable,
00023     without including the source code for Qt in the source distribution.
00024 */
00025 
00026 #include <qhbox.h>
00027 #include <qvbox.h>
00028 #include <qlabel.h>
00029 #include <qfile.h>
00030 #include <qspinbox.h>
00031 #include <qlayout.h>
00032 #include <qpushbutton.h>
00033 #include <qcstring.h>
00034 #include <qdatastream.h>
00035 
00036 #include <dcopclient.h>
00037 #include <dcopref.h>
00038 #include <kapplication.h>
00039 #include <kconfig.h>
00040 #include <kdcopservicestarter.h>
00041 #include <kiconloader.h>
00042 #include <klocale.h>
00043 #include <kprocess.h>
00044 #include <kaudioplayer.h>
00045 #include <kdebug.h>
00046 #include <kmessagebox.h>
00047 #include <knotifyclient.h>
00048 #include <kcombobox.h>
00049 #include <klistview.h>
00050 #include <kwin.h>
00051 #include <klockfile.h>
00052 
00053 #include <libkcal/event.h>
00054 #include <libkcal/incidenceformatter.h>
00055 
00056 #include "koeventviewer.h"
00057 
00058 #include "alarmdialog.h"
00059 #include "alarmdialog.moc"
00060 
00061 static int defSuspendVal = 5;
00062 static int defSuspendUnit = 0; // 0=>minutes, 1=>hours, 2=>days, 3=>weeks
00063 
00064 class AlarmListItem : public KListViewItem
00065 {
00066   public:
00067     AlarmListItem( const QString &uid, QListView *parent )
00068       : KListViewItem( parent ), mUid( uid ), mNotified( false )
00069     {
00070     }
00071 
00072     ~AlarmListItem()
00073     {
00074     }
00075 
00076     int compare( QListViewItem *item, int iCol, bool bAscending ) const;
00077 
00078     QString mDisplayText;
00079 
00080     QString mUid;
00081     QDateTime mRemindAt;
00082     QDateTime mHappening;
00083     bool mNotified;
00084 };
00085 
00086 int AlarmListItem::compare( QListViewItem *item, int iCol, bool bAscending ) const
00087 {
00088   if ( iCol == 1 ) {
00089     AlarmListItem *pItem = static_cast<AlarmListItem *>( item );
00090     return pItem->mHappening.secsTo( mHappening );
00091   } else {
00092     return KListViewItem::compare( item, iCol, bAscending );
00093   }
00094 }
00095 
00096 typedef QValueList<AlarmListItem*> ItemList;
00097 
00098 AlarmDialog::AlarmDialog( KCal::CalendarResources *calendar, QWidget *parent, const char *name )
00099   : KDialogBase( Plain,
00100                  WType_TopLevel | WStyle_Customize | WStyle_StaysOnTop | WStyle_DialogBorder,
00101                  parent, name, false, i18n("Reminder"),
00102                  Ok | User1 | User2 | User3, NoDefault,
00103                  false, i18n("Edit..."), i18n("Dismiss All"), i18n("Dismiss Reminder") ),
00104                  mCalendar( calendar ), mSuspendTimer(this)
00105 {
00106   // User1 => Edit...
00107   // User2 => Dismiss All
00108   // User3 => Dismiss Selected
00109   //    Ok => Suspend
00110 
00111   KGlobal::iconLoader()->addAppDir( "kdepim" );
00112   setButtonOK( i18n( "Suspend" ) );
00113 
00114   setEscapeButton( User2 ); // escape acts like Dismiss All
00115 
00116   QWidget *topBox = plainPage();
00117   QBoxLayout *topLayout = new QVBoxLayout( topBox );
00118   topLayout->setSpacing( spacingHint() );
00119 
00120   QLabel *label = new QLabel( i18n("The following items triggered reminders:"),
00121                               topBox );
00122   topLayout->addWidget( label );
00123 
00124   mIncidenceListView = new KListView( topBox );
00125   mIncidenceListView->addColumn( i18n( "Summary" ) );
00126   mIncidenceListView->addColumn( i18n( "Due" ) );
00127   mIncidenceListView->setSorting( 0, true );
00128   mIncidenceListView->setSorting( 1, true );
00129   mIncidenceListView->setSortColumn( 1 );
00130   mIncidenceListView->setShowSortIndicator( true );
00131   mIncidenceListView->setAllColumnsShowFocus( true );
00132   mIncidenceListView->setSelectionMode( QListView::Extended );
00133   topLayout->addWidget( mIncidenceListView );
00134   connect( mIncidenceListView, SIGNAL(selectionChanged()), SLOT(updateButtons()) );
00135   connect( mIncidenceListView, SIGNAL(doubleClicked(QListViewItem*)), SLOT(edit()) );
00136   connect( mIncidenceListView, SIGNAL(currentChanged(QListViewItem*)), SLOT(showDetails()) );
00137   connect( mIncidenceListView, SIGNAL(selectionChanged()), SLOT(showDetails()) );
00138 
00139   mDetailView = new KOEventViewer( mCalendar, topBox );
00140   mDetailView->setFocus(); // set focus here to start with to make it harder
00141                            // to hit return by mistake and dismiss a reminder.
00142   topLayout->addWidget( mDetailView );
00143 
00144   QHBox *suspendBox = new QHBox( topBox );
00145   suspendBox->setSpacing( spacingHint() );
00146   topLayout->addWidget( suspendBox );
00147 
00148   QLabel *l = new QLabel( i18n("Suspend &duration:"), suspendBox );
00149   mSuspendSpin = new QSpinBox( 1, 9999, 1, suspendBox );
00150   mSuspendSpin->setValue( defSuspendVal );  // default suspend duration
00151   l->setBuddy( mSuspendSpin );
00152 
00153   mSuspendUnit = new KComboBox( suspendBox );
00154   mSuspendUnit->insertItem( i18n("minute(s)") );
00155   mSuspendUnit->insertItem( i18n("hour(s)") );
00156   mSuspendUnit->insertItem( i18n("day(s)") );
00157   mSuspendUnit->insertItem( i18n("week(s)") );
00158   mSuspendUnit->setCurrentItem( defSuspendUnit );
00159 
00160   connect( &mSuspendTimer, SIGNAL(timeout()), SLOT(wakeUp()) );
00161 
00162   setMainWidget( mIncidenceListView );
00163   mIncidenceListView->setMinimumSize( 500, 200 );
00164 }
00165 
00166 AlarmDialog::~AlarmDialog()
00167 {
00168   mIncidenceListView->clear();
00169 }
00170 
00171 AlarmListItem *AlarmDialog::searchByUid( const QString &uid )
00172 {
00173   AlarmListItem *found = 0;
00174   for ( QListViewItemIterator it( mIncidenceListView ) ; it.current() ; ) {
00175     AlarmListItem *item = static_cast<AlarmListItem*>( it.current() );
00176     if ( item->mUid == uid ) {
00177       found = item;
00178       break;
00179     }
00180     ++it;
00181   }
00182   return found;
00183 }
00184 
00185 static QString etc = i18n( "elipsis", "..." );
00186 static QString cleanSummary( const QString &summary )
00187 {
00188   uint maxLen = 45;
00189   QString retStr = summary;
00190   retStr.replace( '\n', ' ' );
00191   if ( retStr.length() > maxLen ) {
00192     maxLen -= etc.length();
00193     retStr = retStr.left( maxLen );
00194     retStr += etc;
00195   }
00196   return retStr;
00197 }
00198 
00199 void AlarmDialog::addIncidence( Incidence *incidence,
00200                                 const QDateTime &reminderAt,
00201                                 const QString &displayText )
00202 {
00203   AlarmListItem *item = searchByUid( incidence->uid() );
00204   if ( !item ) {
00205     item = new AlarmListItem( incidence->uid(), mIncidenceListView );
00206   }
00207   item->mNotified = false;
00208   item->mHappening = QDateTime();
00209   item->mRemindAt = reminderAt;
00210   item->mDisplayText = displayText;
00211   item->setText( 0, cleanSummary( incidence->summary() ) );
00212   item->setText( 1, QString() );
00213 
00214   Event *event;
00215   Todo *todo;
00216   Alarm *alarm = incidence->alarms().first();
00217   if ( incidence->type() == "Event" ) {
00218     item->setPixmap( 0, SmallIcon( "appointment" ) );
00219     event = static_cast<Event *>( incidence );
00220     if ( event->doesRecur() ) {
00221       QDateTime nextStart = event->recurrence()->getNextDateTime( reminderAt );
00222       if ( nextStart.isValid() ) {
00223         item->mHappening = nextStart;
00224         item->setText( 1, KGlobal::locale()->formatDateTime( nextStart ) );
00225       }
00226     }
00227     if ( item->text( 1 ).isEmpty() ) {
00228       QDateTime qdt;
00229       if ( alarm->hasStartOffset() ) {
00230         qdt = event->dtStart();
00231       } else {
00232         qdt = event->dtEnd();
00233       }
00234       item->mHappening = qdt;
00235       item->setText( 1, IncidenceFormatter::dateTimeToString( qdt, false, true ) );
00236     }
00237   } else if ( incidence->type() == "Todo" ) {
00238     item->setPixmap( 0, SmallIcon( "todo" ) );
00239     todo = static_cast<Todo *>( incidence );
00240     if ( todo->doesRecur() ) {
00241       QDateTime nextStart = todo->recurrence()->getNextDateTime( reminderAt );
00242       if ( nextStart.isValid() ) {
00243         item->mHappening = nextStart;
00244         item->setText( 1, KGlobal::locale()->formatDateTime( nextStart ) );
00245       }
00246     }
00247     if ( item->text( 1 ).isEmpty() ) {
00248       QDateTime qdt;
00249       if ( alarm->hasStartOffset() && todo->dtStart().isValid() ) {
00250         qdt = todo->dtStart();
00251       } else {
00252         qdt = todo->dtDue();
00253       }
00254       item->mHappening = qdt;
00255       item->setText( 1, IncidenceFormatter::dateTimeToString( qdt, false, true ) );
00256     }
00257   }
00258 
00259   if ( activeCount() == 1 ) {// previously empty
00260     mIncidenceListView->clearSelection();
00261     item->setSelected( true );
00262   }
00263   showDetails();
00264 }
00265 
00266 void AlarmDialog::slotOk()
00267 {
00268   suspend();
00269 }
00270 
00271 void AlarmDialog::slotUser1()
00272 {
00273   edit();
00274 }
00275 
00276 void AlarmDialog::slotUser2()
00277 {
00278   dismissAll();
00279 }
00280 
00281 void AlarmDialog::slotUser3()
00282 {
00283   dismissCurrent();
00284 }
00285 
00286 void AlarmDialog::dismissCurrent()
00287 {
00288   ItemList selection = selectedItems();
00289   for ( ItemList::Iterator it = selection.begin(); it != selection.end(); ++it ) {
00290     if ( (*it)->itemBelow() )
00291       (*it)->itemBelow()->setSelected( true );
00292     else if ( (*it)->itemAbove() )
00293       (*it)->itemAbove()->setSelected( true );
00294     delete *it;
00295   }
00296   if ( activeCount() == 0 ) {
00297     accept();
00298   } else {
00299     updateButtons();
00300     showDetails();
00301   }
00302   emit reminderCount( activeCount() );
00303 }
00304 
00305 void AlarmDialog::dismissAll()
00306 {
00307   for ( QListViewItemIterator it( mIncidenceListView ) ; it.current() ; ) {
00308     AlarmListItem *item = static_cast<AlarmListItem*>( it.current() );
00309     if ( !item->isVisible() ) {
00310       ++it;
00311       continue;
00312     }
00313     mIncidenceListView->takeItem( item );
00314     delete item;
00315   }
00316   setTimer();
00317   accept();
00318   emit reminderCount( activeCount() );
00319 }
00320 
00321 void AlarmDialog::edit()
00322 {
00323   ItemList selection = selectedItems();
00324   if ( selection.count() != 1 ) {
00325     return;
00326   }
00327   Incidence *incidence = mCalendar->incidence( selection.first()->mUid );
00328   if ( !incidence ) {
00329     return;
00330   }
00331   QDate dt = selection.first()->mRemindAt.date();
00332 
00333   if ( incidence->isReadOnly() ) {
00334     KMessageBox::sorry(
00335       this,
00336       i18n( "\"%1\" is a read-only item so modifications are not possible." ).
00337       arg( cleanSummary( incidence->summary() ) ) );
00338     return;
00339   }
00340 
00341   if ( !ensureKorganizerRunning() ) {
00342     KMessageBox::error(
00343       this,
00344       i18n( "Could not start KOrganizer so editing is not possible." ) );
00345     return;
00346   }
00347 
00348   QByteArray data;
00349   QDataStream arg( data, IO_WriteOnly );
00350   arg << incidence->uid();
00351   arg << dt;
00352   //kdDebug(5890) << "editing incidence " << incidence->summary() << endl;
00353   if ( !kapp->dcopClient()->send( "korganizer", "KOrganizerIface",
00354                                   "editIncidence(QString,QDate)",
00355                                   data ) ) {
00356     KMessageBox::error(
00357       this,
00358       i18n( "An internal KOrganizer error occurred attempting to start the incidence editor" ) );
00359     return;
00360   }
00361 
00362   // get desktop # where korganizer (or kontact) runs
00363   QByteArray replyData;
00364   QCString object, replyType;
00365   object = kapp->dcopClient()->isApplicationRegistered( "kontact" ) ?
00366            "kontact-mainwindow#1" : "KOrganizer MainWindow";
00367   if (!kapp->dcopClient()->call( "korganizer", object,
00368                             "getWinID()", 0, replyType, replyData, true, -1 ) ) {
00369   }
00370 
00371   if ( replyType == "int" ) {
00372     int desktop, window;
00373     QDataStream ds( replyData, IO_ReadOnly );
00374     ds >> window;
00375     desktop = KWin::windowInfo( window ).desktop();
00376 
00377     if ( KWin::currentDesktop() == desktop ) {
00378       KWin::iconifyWindow( winId(), false );
00379     } else {
00380       KWin::setCurrentDesktop( desktop );
00381     }
00382     KWin::activateWindow( KWin::transientFor( window ) );
00383   }
00384 }
00385 
00386 void AlarmDialog::suspend()
00387 {
00388   if ( !isVisible() )
00389     return;
00390 
00391   int unit=1;
00392   switch (mSuspendUnit->currentItem()) {
00393     case 3: // weeks
00394       unit *=  7;
00395     case 2: // days
00396       unit *= 24;
00397     case 1: // hours
00398       unit *= 60;
00399     case 0: // minutes
00400       unit *= 60;
00401     default:
00402       break;
00403   }
00404 
00405   for ( QListViewItemIterator it( mIncidenceListView ) ; it.current() ; ++it ) {
00406     AlarmListItem * item = static_cast<AlarmListItem*>( it.current() );
00407     if ( item->isSelected() && item->isVisible() ) {
00408       item->setVisible( false );
00409       item->setSelected( false );
00410       item->mRemindAt = QDateTime::currentDateTime().addSecs( unit * mSuspendSpin->value() );
00411       item->mNotified = false;
00412     }
00413   }
00414 
00415   // save suspended alarms too so they can be restored on restart
00416   // kolab/issue4108
00417   slotSave();
00418 
00419   setTimer();
00420   if ( activeCount() == 0 ) {
00421     accept();
00422   } else {
00423     updateButtons();
00424     showDetails();
00425   }
00426   emit reminderCount( activeCount() );
00427 }
00428 
00429 void AlarmDialog::setTimer()
00430 {
00431   int nextReminderAt = -1;
00432   for ( QListViewItemIterator it( mIncidenceListView ) ; it.current() ; ++it ) {
00433     AlarmListItem * item = static_cast<AlarmListItem*>( it.current() );
00434     if ( item->mRemindAt > QDateTime::currentDateTime() ) {
00435       int secs = QDateTime::currentDateTime().secsTo( item->mRemindAt );
00436       nextReminderAt = nextReminderAt <= 0 ? secs : QMIN( nextReminderAt, secs );
00437     }
00438   }
00439 
00440   if ( nextReminderAt >= 0 ) {
00441     mSuspendTimer.stop();
00442     mSuspendTimer.start( 1000 * (nextReminderAt + 1), true );
00443   }
00444 }
00445 
00446 void AlarmDialog::show()
00447 {
00448   mIncidenceListView->sort();
00449 
00450   mIncidenceListView->clearSelection();
00451   if ( mIncidenceListView->firstChild() )
00452     mIncidenceListView->firstChild()->setSelected( true );
00453 
00454   updateButtons();
00455   showDetails();
00456 
00457   // reset the default suspend time
00458   mSuspendSpin->setValue( defSuspendVal );
00459   mSuspendUnit->setCurrentItem( defSuspendUnit );
00460 
00461   KDialogBase::show();
00462   KWin::deIconifyWindow( winId(), false );
00463   KWin::setState( winId(), NET::KeepAbove );
00464   KWin::setOnAllDesktops( winId(), true );
00465   eventNotification();
00466 }
00467 
00468 void AlarmDialog::eventNotification()
00469 {
00470   bool beeped = false, found = false;
00471 
00472   QValueList<AlarmListItem*> list;
00473   for ( QListViewItemIterator it( mIncidenceListView ) ; it.current() ; ++it ) {
00474     AlarmListItem *item = static_cast<AlarmListItem*>( it.current() );
00475     if ( !item->isVisible() || item->mNotified ) {
00476       continue;
00477     }
00478     Incidence *incidence = mCalendar->incidence( item->mUid );
00479     if ( !incidence ) {
00480       continue;
00481     }
00482     found = true;
00483     item->mNotified = true;
00484     Alarm::List alarms = incidence->alarms();
00485     Alarm::List::ConstIterator it;
00486     for ( it = alarms.begin(); it != alarms.end(); ++it ) {
00487       Alarm *alarm = *it;
00488       // FIXME: Check whether this should be done for all multiple alarms
00489       if (alarm->type() == Alarm::Procedure) {
00490         // FIXME: Add a message box asking whether the procedure should really be executed
00491         kdDebug(5890) << "Starting program: '" << alarm->programFile() << "'" << endl;
00492         KProcess proc;
00493         proc << QFile::encodeName(alarm->programFile());
00494         proc.start(KProcess::DontCare);
00495       }
00496       else if (alarm->type() == Alarm::Audio) {
00497         beeped = true;
00498         KAudioPlayer::play(QFile::encodeName(alarm->audioFile()));
00499       }
00500     }
00501   }
00502 
00503   if ( !beeped && found ) {
00504     KNotifyClient::beep();
00505   }
00506 }
00507 
00508 void AlarmDialog::wakeUp()
00509 {
00510   bool activeReminders = false;
00511   for ( QListViewItemIterator it( mIncidenceListView ) ; it.current() ; ++it ) {
00512     AlarmListItem *item = static_cast<AlarmListItem*>( it.current() );
00513     Incidence *incidence = mCalendar->incidence( item->mUid );
00514     if ( !incidence ) {
00515       delete item;
00516       continue;
00517     }
00518 
00519     if ( item->mRemindAt <= QDateTime::currentDateTime() ) {
00520       if ( !item->isVisible() ) {
00521         item->setVisible( true );
00522         item->setSelected( false );
00523       }
00524       activeReminders = true;
00525     } else {
00526       item->setVisible( false );
00527     }
00528   }
00529 
00530   if ( activeReminders )
00531     show();
00532   setTimer();
00533   showDetails();
00534   emit reminderCount( activeCount() );
00535 }
00536 
00537 void AlarmDialog::slotSave()
00538 {
00539   KConfig *config = kapp->config();
00540   KLockFile::Ptr lock = config->lockFile();
00541   if ( lock.data()->lock() != KLockFile::LockOK )
00542     return;
00543 
00544   config->setGroup( "General" );
00545   int numReminders = config->readNumEntry("Reminders", 0);
00546 
00547   for ( QListViewItemIterator it( mIncidenceListView ) ; it.current() ; ++it ) {
00548     AlarmListItem *item = static_cast<AlarmListItem*>( it.current() );
00549     Incidence *incidence = mCalendar->incidence( item->mUid );
00550     if ( !incidence ) {
00551       continue;
00552     }
00553     config->setGroup( QString("Incidence-%1").arg(numReminders + 1) );
00554     config->writeEntry( "UID", incidence->uid() );
00555     config->writeEntry( "RemindAt", item->mRemindAt );
00556     ++numReminders;
00557   }
00558 
00559   config->setGroup( "General" );
00560   config->writeEntry( "Reminders", numReminders );
00561   config->sync();
00562   lock.data()->unlock();
00563 }
00564 
00565 void AlarmDialog::updateButtons()
00566 {
00567   ItemList selection = selectedItems();
00568   enableButton( User1, selection.count() == 1 ); // can only edit 1 at a time
00569   enableButton( User3, selection.count() > 0 );  // dismiss 1 or more
00570   enableButton( Ok, selection.count() > 0 );     // suspend 1 or more
00571 }
00572 
00573 QValueList< AlarmListItem * > AlarmDialog::selectedItems() const
00574 {
00575   QValueList<AlarmListItem*> list;
00576   for ( QListViewItemIterator it( mIncidenceListView ) ; it.current() ; ++it ) {
00577     if ( it.current()->isSelected() )
00578       list.append( static_cast<AlarmListItem*>( it.current() ) );
00579   }
00580   return list;
00581 }
00582 
00583 int AlarmDialog::activeCount()
00584 {
00585   int count = 0;
00586   for ( QListViewItemIterator it( mIncidenceListView ) ; it.current() ; ++it ) {
00587     AlarmListItem * item = static_cast<AlarmListItem*>( it.current() );
00588     if ( item->isVisible() )
00589       ++count;
00590   }
00591   return count;
00592 }
00593 
00594 void AlarmDialog::suspendAll()
00595 {
00596   mIncidenceListView->clearSelection();
00597   for ( QListViewItemIterator it( mIncidenceListView ) ; it.current() ; ++it ) {
00598     if ( it.current()->isVisible() )
00599       it.current()->setSelected( true );
00600   }
00601   suspend();
00602 }
00603 
00604 void AlarmDialog::showDetails()
00605 {
00606   mDetailView->clearEvents( true );
00607   mDetailView->clear();
00608   AlarmListItem *item = static_cast<AlarmListItem*>( mIncidenceListView->currentItem() );
00609   if ( !item || !item->isVisible() )
00610     return;
00611 
00612   Incidence *incidence = mCalendar->incidence( item->mUid );
00613   if ( !incidence ) {
00614     return;
00615   }
00616 
00617   if ( !item->mDisplayText.isEmpty() ) {
00618     QString txt = "<qt><p><b>" + item->mDisplayText + "</b></p></qt>";
00619     mDetailView->addText( txt );
00620   }
00621   item->setText( 0, cleanSummary( incidence->summary() ) );
00622   mDetailView->appendIncidence( incidence, item->mRemindAt.date() );
00623 }
00624 
00625 bool AlarmDialog::ensureKorganizerRunning() const
00626 {
00627   QString error;
00628   QCString dcopService;
00629 
00630   int result = KDCOPServiceStarter::self()->findServiceFor(
00631     "DCOP/Organizer", QString::null, QString::null, &error, &dcopService );
00632 
00633   if ( result == 0 ) {
00634     // OK, so korganizer (or kontact) is running. Now ensure the object we
00635     // want is available [that's not the case when kontact was already running,
00636     // but korganizer not loaded into it...]
00637     static const char* const dcopObjectId = "KOrganizerIface";
00638     QCString dummy;
00639     if ( !kapp->dcopClient()->findObject(
00640            dcopService, dcopObjectId, "", QByteArray(), dummy, dummy ) ) {
00641       DCOPRef ref( dcopService, dcopService ); // talk to KUniqueApplication or its kontact wrapper
00642       DCOPReply reply = ref.call( "load()" );
00643       if ( reply.isValid() && (bool)reply ) {
00644         Q_ASSERT( kapp->dcopClient()->findObject(
00645                     dcopService, dcopObjectId, "", QByteArray(), dummy, dummy ) );
00646       } else {
00647         kdWarning() << "Error loading " << dcopService << endl;
00648       }
00649     }
00650 
00651     // We don't do anything with it we just need it to be running
00652     return true;
00653 
00654   } else {
00655     kdWarning() << "Couldn't start DCOP/Organizer: " << dcopService
00656                 << " " << error << endl;
00657   }
00658   return false;
00659 }
KDE Home | KDE Accessibility Home | Description of Access Keys