-rw-r--r-- | korganizer/kodialogmanager.cpp | 87 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 59 |
2 files changed, 78 insertions, 68 deletions
diff --git a/korganizer/kodialogmanager.cpp b/korganizer/kodialogmanager.cpp index 41a4dc1..1af9dad 100644 --- a/korganizer/kodialogmanager.cpp +++ b/korganizer/kodialogmanager.cpp @@ -1,346 +1,349 @@ /* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <libkdepim/categoryeditdialog.h> #include "calendarview.h" #include "incomingdialog.h" #include "outgoingdialog.h" #include "koprefsdialog.h" #include "koeventeditor.h" #include "koprefs.h" #include "datenavigator.h" #include "kotodoeditor.h" #include "searchdialog.h" #include "filtereditdialog.h" #ifndef KORG_NOPLUGINS #include "plugindialog.h" #endif #ifndef KORG_NOARCHIVE #include "archivedialog.h" #endif #include "kconfig.h" #include "kodialogmanager.h" KODialogManager::KODialogManager( CalendarView *mainView ) : QObject(), mMainView( mainView ) { mOutgoingDialog = 0; mIncomingDialog = 0; mOptionsDialog = 0; mSearchDialog = 0; mArchiveDialog = 0; mFilterEditDialog = 0; mPluginDialog = 0; // mCategoryEditDialog = new KPIM::CategoryEditDialog(KOPrefs::instance(),mMainView); //KOGlobals::fitDialogToScreen( mCategoryEditDialog ); } KODialogManager::~KODialogManager() { delete mOutgoingDialog; delete mIncomingDialog; delete mOptionsDialog; delete mSearchDialog; #ifndef KORG_NOARCHIVE delete mArchiveDialog; #endif delete mFilterEditDialog; #ifndef KORG_NOPLUGINS delete mPluginDialog; #endif } OutgoingDialog *KODialogManager::outgoingDialog() { createOutgoingDialog(); return mOutgoingDialog; } void KODialogManager::createOutgoingDialog() { if (!mOutgoingDialog) { mOutgoingDialog = new OutgoingDialog(mMainView->calendar(),mMainView); if (mIncomingDialog) mIncomingDialog->setOutgoingDialog(mOutgoingDialog); connect(mOutgoingDialog,SIGNAL(numMessagesChanged(int)), mMainView,SIGNAL(numOutgoingChanged(int))); } } void KODialogManager::showOptionsDialog( bool showSync ) { if (!mOptionsDialog) { mOptionsDialog = new KOPrefsDialog(mMainView); //mOptionsDialog->readConfig(); connect(mOptionsDialog,SIGNAL(configChanged()), mMainView,SLOT(updateConfig())); //connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), // mOptionsDialog,SLOT(updateCategories())); } mOptionsDialog->readConfig(); #ifndef DESKTOP_VERSION mOptionsDialog->showMaximized(); #else mOptionsDialog->show(); #endif if ( showSync ) mOptionsDialog->showSyncPage(); mOptionsDialog->exec(); } void KODialogManager::showSyncOptions() { showOptionsDialog( true ); } void KODialogManager::showOutgoingDialog() { createOutgoingDialog(); mOutgoingDialog->show(); mOutgoingDialog->raise(); } IncomingDialog *KODialogManager::incomingDialog() { createOutgoingDialog(); if (!mIncomingDialog) { mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), mMainView,SIGNAL(numIncomingChanged(int))); connect(mIncomingDialog,SIGNAL(calendarUpdated()), mMainView,SLOT(updateView())); } return mIncomingDialog; } void KODialogManager::createIncomingDialog() { createOutgoingDialog(); if (!mIncomingDialog) { mIncomingDialog = new IncomingDialog(mMainView->calendar(),mOutgoingDialog,mMainView); connect(mIncomingDialog,SIGNAL(numMessagesChanged(int)), mMainView,SIGNAL(numIncomingChanged(int))); connect(mIncomingDialog,SIGNAL(calendarUpdated()), mMainView,SLOT(updateView())); } } void KODialogManager::showIncomingDialog() { createIncomingDialog(); mIncomingDialog->show(); mIncomingDialog->raise(); } /* void KODialogManager::showCategoryEditDialog() { mCategoryEditDialog->show(); } */ void KODialogManager::hideSearchDialog() { if (mSearchDialog) mSearchDialog->hide(); } void KODialogManager::showSearchDialog() { - if (!mSearchDialog) { - mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView); - KOListView * lview = mSearchDialog->listview(); - - connect(lview, SIGNAL(showIncidenceSignal(Incidence *)), - mMainView, SLOT(showIncidence(Incidence *))); - connect(lview, SIGNAL(editIncidenceSignal(Incidence *)), - mMainView, SLOT(editIncidence(Incidence *))); - connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)), - mMainView, SLOT(deleteIncidence(Incidence *))); - connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)), - mMainView, SLOT(cloneIncidence(Incidence *))); - connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)), - mMainView, SLOT(beamIncidence(Incidence *))); - connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)), - mMainView, SLOT(moveIncidence(Incidence *))); - connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )), - mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> ))); - - connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig())); - connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList())); - // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ), - // mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); + if (!mSearchDialog) { + mSearchDialog = new SearchDialog(mMainView->calendar(),mMainView); + KOListView * lview = mSearchDialog->listview(); + + connect(lview, SIGNAL(showIncidenceSignal(Incidence *)), + mMainView, SLOT(showIncidence(Incidence *))); + connect(lview, SIGNAL(editIncidenceSignal(Incidence *)), + mMainView, SLOT(editIncidence(Incidence *))); + connect(lview, SIGNAL(deleteIncidenceSignal(Incidence *)), + mMainView, SLOT(deleteIncidence(Incidence *))); + connect(lview, SIGNAL(cloneIncidenceSignal(Incidence *)), + mMainView, SLOT(cloneIncidence(Incidence *))); + connect(lview, SIGNAL(beamIncidenceSignal(Incidence *)), + mMainView, SLOT(beamIncidence(Incidence *))); + connect(lview, SIGNAL(moveIncidenceSignal(Incidence *)), + mMainView, SLOT(moveIncidence(Incidence *))); + connect(lview, SIGNAL(beamIncidenceList(QPtrList<Incidence> )), + mMainView, SLOT(beamIncidenceList(QPtrList<Incidence> ))); + + connect(mMainView, SIGNAL(configChanged()), mSearchDialog, SLOT(updateConfig())); + connect(mMainView, SIGNAL(updateSearchDialog()), mSearchDialog, SLOT(updateList())); + // connect( lview, SIGNAL( incidenceSelected( Incidence * ) ), + // mMainView, SLOT( processMainViewSelection( Incidence * ) ) ); #ifndef DESKTOP_VERSION - mSearchDialog->setMaximumSize( QApplication::desktop()->size()); - //mSearchDialog->setGeometry( 40,40, 400, 300); - mSearchDialog->showMaximized(); + mSearchDialog->setMaximumSize( QApplication::desktop()->size()); + mSearchDialog->showMaximized(); #else - KConfig *config = KOGlobals::config(); - config->setGroup("WidgetLayout"); - QStringList list; - list = config->readListEntry("SearchLayout"); - int x,y,w,h; - if ( ! list.isEmpty() ) { - x = list[0].toInt(); - y = list[1].toInt(); - w = list[2].toInt(); - h = list[3].toInt(); - mSearchDialog->setGeometry(x,y,w,h); + KConfig *config = KOGlobals::config(); + config->setGroup("WidgetLayout"); + QStringList list; + list = config->readListEntry("SearchLayout"); + int x,y,w,h; + if ( ! list.isEmpty() ) { + x = list[0].toInt(); + y = list[1].toInt(); + w = list[2].toInt(); + h = list[3].toInt(); + mSearchDialog->setGeometry(x,y,w,h); - } + } #endif - } - // make sure the widget is on top again - mSearchDialog->show(); - mSearchDialog->raise(); + } + // make sure the widget is on top again +#ifdef DESKTOP_VERSION + mSearchDialog->show(); +#else + mSearchDialog->showMaximized(); +#endif + mSearchDialog->raise(); } SearchDialog * KODialogManager::getSearchDialog() { return mSearchDialog; } void KODialogManager::showArchiveDialog() { #ifndef KORG_NOARCHIVE if (!mArchiveDialog) { mArchiveDialog = new ArchiveDialog(mMainView->calendar(),mMainView); connect(mArchiveDialog,SIGNAL(eventsDeleted()), mMainView,SLOT(updateView())); } mArchiveDialog->show(); mArchiveDialog->raise(); // Workaround. QApplication::restoreOverrideCursor(); #endif } void KODialogManager::showFilterEditDialog(QPtrList<CalFilter> *filters) { if (!mFilterEditDialog) { mFilterEditDialog = new FilterEditDialog(filters,mMainView); connect(mFilterEditDialog,SIGNAL(filterChanged()), mMainView,SLOT(filterEdited())); } #ifndef DESKTOP_VERSION mFilterEditDialog->showMaximized(); #else mFilterEditDialog->show(); #endif mFilterEditDialog->raise(); } void KODialogManager::showPluginDialog() { #ifndef KORG_NOPLUGINS if (!mPluginDialog) { mPluginDialog = new PluginDialog(mMainView); connect(mPluginDialog,SIGNAL(configChanged()), mMainView,SLOT(updateConfig())); } mPluginDialog->show(); mPluginDialog->raise(); #endif } KOEventEditor *KODialogManager::getEventEditor() { KOEventEditor *eventEditor = new KOEventEditor( mMainView->calendar(), mMainView ); connect(eventEditor,SIGNAL(eventAdded(Event *)), mMainView,SLOT(eventAdded(Event *))); connect(eventEditor,SIGNAL(eventChanged(Event *)), mMainView,SLOT(eventChanged(Event *))); connect(eventEditor,SIGNAL(eventDeleted()), mMainView,SLOT(eventDeleted())); connect(eventEditor,SIGNAL(deleteAttendee(Incidence *)), mMainView,SLOT(schedule_cancel(Incidence *))); connect( eventEditor, SIGNAL(jumpToTime( const QDate &)), mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); connect( eventEditor, SIGNAL( showAgendaView( bool)), mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), // eventEditor,SLOT(updateCategoryConfig())); // connect(eventEditor,SIGNAL(editCategories()), // mCategoryEditDialog,SLOT(show())); connect(eventEditor,SIGNAL(dialogClose(Incidence*)), mMainView,SLOT(dialogClosing(Incidence*))); //connect(mMainView,SIGNAL(closingDown()),eventEditor,SLOT(reject())); #ifndef DESKTOP_VERSION eventEditor->resize( QApplication::desktop()->width() -20, 100 ); #endif return eventEditor; } KOTodoEditor *KODialogManager::getTodoEditor() { KOTodoEditor *todoEditor = new KOTodoEditor( mMainView->calendar(), mMainView ); // connect(mCategoryEditDialog,SIGNAL(categoryConfigChanged()), // todoEditor,SLOT(updateCategoryConfig())); // connect(todoEditor,SIGNAL(editCategories()),mCategoryEditDialog,SLOT(show())); connect(todoEditor,SIGNAL(todoAdded(Todo *)), mMainView,SLOT(todoAdded(Todo *))); connect(todoEditor,SIGNAL(todoChanged(Todo *)), mMainView,SLOT(todoChanged(Todo *))); connect(todoEditor,SIGNAL(todoDeleted()), mMainView,SLOT(todoDeleted())); connect(todoEditor,SIGNAL(dialogClose(Incidence*)), mMainView,SLOT(dialogClosing(Incidence*))); connect( todoEditor, SIGNAL(jumpToTime( const QDate &)), mMainView->dateNavigator(), SLOT( selectWeek( const QDate & ) ) ); connect( todoEditor, SIGNAL( showAgendaView( bool)), mMainView->viewManager(), SLOT( showAgendaView( bool) ) ); // connect(todoEditor,SIGNAL(deleteAttendee(Incidence *)), // mMainView,SLOT(schedule_cancel(Incidence *))); //connect(mMainView,SIGNAL(closingDown()),todoEditor,SLOT(reject())); #ifndef DESKTOP_VERSION todoEditor->resize( QApplication::desktop()->width() -20, 100 ); #endif return todoEditor; } void KODialogManager::updateSearchDialog() { if (mSearchDialog) mSearchDialog->updateView(); } void KODialogManager::setDocumentId( const QString &id ) { if (mOutgoingDialog) mOutgoingDialog->setDocumentId( id ); } void KODialogManager::writeSettings( KConfig *config ) { if (mSearchDialog) mSearchDialog->listview()->writeSettings(config,"SearchListView Layout"); } diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 019f41f..4f71788 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -132,1172 +132,1179 @@ int globalFlagBlockStartup; MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : QMainWindow( parent, name ) { mClosed = false; //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; QString confFile = locateLocal("config","korganizerrc"); QFileInfo finf ( confFile ); bool showWarning = !finf.exists(); setIcon(SmallIcon( "ko24" ) ); mBlockAtStartup = true; mFlagKeyPressed = false; setCaption("KOrganizer/Pi"); KOPrefs *p = KOPrefs::instance(); KPimGlobalPrefs::instance()->setGlobalConfig(); if ( p->mHourSize > 22 ) p->mHourSize = 22; QMainWindow::ToolBarDock tbd; if ( p->mToolBarHor ) { if ( p->mToolBarUp ) tbd = Bottom; else tbd = Top; } else { if ( p->mToolBarUp ) tbd = Right; else tbd = Left; } if ( KOPrefs::instance()->mUseAppColors ) QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); globalFlagBlockStartup = 1; iconToolBar = new QPEToolBar( this ); addToolBar (iconToolBar , tbd ); mCalendarModifiedFlag = false; QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); splash->setAlignment ( AlignCenter ); setCentralWidget( splash ); #ifndef DESKTOP_VERSION showMaximized(); #endif //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); setDefaultPreferences(); mCalendar = new CalendarLocal(); mView = new CalendarView( mCalendar, this,"mCalendar " ); mView->hide(); //mView->resize(splash->size() ); initActions(); mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); mSyncManager->setBlockSave(false); mView->setSyncManager(mSyncManager); #ifndef DESKTOP_VERSION iconToolBar->show(); qApp->processEvents(); #endif //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); int vh = height() ; int vw = width(); //qDebug("Toolbar hei %d ",iconToolBar->height() ); if ( iconToolBar->orientation () == Qt:: Horizontal ) { vh -= iconToolBar->height(); } else { vw -= iconToolBar->height(); } //mView->setMaximumSize( splash->size() ); //mView->resize( splash->size() ); //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); mView->readSettings(); bool newFile = false; if( !QFile::exists( defaultFileName() ) ) { QFileInfo finfo ( defaultFileName() ); QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); qDebug("oldfile %s ", oldFile.latin1()); QString message = "You are starting KO/Pi for the\nfirst time after updating to a\nversion >= 1.9.1. The location of the\ndefault calendar file has changed.\nA mycalendar.ics file was detected\nat the old location.\nThis file will be loaded now\nand stored at the new location!\n(Config file location has changed, too!)\nPlease read menu Help-What's New!\n"; finfo.setFile( oldFile ); if (finfo.exists() ) { KMessageBox::information( this, message); mView->openCalendar( oldFile ); qApp->processEvents(); } else { oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); finfo.setFile( oldFile ); if (finfo.exists() ) { KMessageBox::information( this, message); mView->openCalendar( oldFile ); qApp->processEvents(); } } mView->saveCalendar( defaultFileName() ); newFile = true; } QTime neededSaveTime = QDateTime::currentDateTime().time(); mView->openCalendar( defaultFileName() ); int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); qDebug("KO: Calendar loading time: %d ms",msNeeded ); if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { KOPrefs::instance()->setAllDefaults(); int count = mView->addCategories(); } processIncidenceSelection( 0 ); connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), SLOT( processIncidenceSelection( Incidence * ) ) ); connect( mView, SIGNAL( modifiedChanged( bool ) ), SLOT( slotModifiedChanged( bool ) ) ); connect( mView, SIGNAL( tempDisableBR(bool) ), SLOT( disableBR(bool) ) ); connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); mView->setModified( false ); mBlockAtStartup = false; mView->setModified( false ); setCentralWidget( mView ); globalFlagBlockStartup = 0; mView->show(); delete splash; if ( newFile ) mView->updateConfig(); // qApp->processEvents(); //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); //fillSyncMenu(); connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); mSyncManager->setDefaultFileName( sentSyncFile()); connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); mSyncManager->fillSyncMenu(); mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); if ( showWarning ) { KMessageBox::information( this, "You are starting KO/Pi for the first time.\nPlease read menu: Help-What's New,\nif you did an update!\nPlease choose your timezone in the \nConfigure Dialog TAB Time Zone!\nPlease choose your language\nin the TAB Locale!\nYou get the Configure Dialog\nvia Menu: Actions - Configure....\nClick OK to show the Configure Dialog!\n", "KO/Pi information"); qApp->processEvents(); mView->dialogManager()->showSyncOptions(); } //US listen for result adressed from Ka/Pi #ifndef DESKTOP_VERSION connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); #endif #ifndef DESKTOP_VERSION infrared = 0; #endif updateWeek( mView->startDate() ); connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), SLOT( updateWeekNum( const KCal::DateList & ) ) ); mBRdisabled = false; //toggleBeamReceive(); } MainWindow::~MainWindow() { //qDebug("MainWindow::~MainWindow() "); //save toolbar location delete mCalendar; delete mSyncManager; #ifndef DESKTOP_VERSION if ( infrared ) delete infrared; #endif } void MainWindow::disableBR(bool b) { #ifndef DESKTOP_VERSION if ( b ) { if ( infrared ) { toggleBeamReceive(); mBRdisabled = true; } mBRdisabled = true; } else { if ( mBRdisabled ) { mBRdisabled = false; //makes no sense,because other cal ap is probably running // toggleBeamReceive(); } } #endif } bool MainWindow::beamReceiveEnabled() { #ifndef DESKTOP_VERSION return ( infrared != 0 ); #endif return false; } void MainWindow::toggleBeamReceive() { if ( mBRdisabled ) return; #ifndef DESKTOP_VERSION if ( infrared ) { qDebug("disable BeamReceive "); delete infrared; infrared = 0; brAction->setOn(false); return; } qDebug("enable BeamReceive "); brAction->setOn(true); infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); #endif } void MainWindow::showMaximized () { #ifndef DESKTOP_VERSION if ( ! globalFlagBlockStartup ) if ( mClosed ) mView->goToday(); #endif QWidget::showMaximized () ; mClosed = false; } void MainWindow::closeEvent( QCloseEvent* ce ) { if ( ! KOPrefs::instance()->mAskForQuit ) { saveOnClose(); mClosed = true; ce->accept(); return; } switch( QMessageBox::information( this, "KO/Pi", i18n("Do you really want\nto close KO/Pi?"), i18n("Close"), i18n("No"), 0, 0 ) ) { case 0: saveOnClose(); mClosed = true; ce->accept(); break; case 1: ce->ignore(); break; case 2: default: break; } } void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) { QDataStream stream( data, IO_ReadOnly ); // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); //QString datamess; //qDebug("message "); qDebug("KO: QCOP message received: %s ", cmsg.data() ); if ( cmsg == "setDocument(QString)" ) { QDataStream stream( data, IO_ReadOnly ); QString fileName; stream >> fileName; //qDebug("filename %s ", fileName.latin1()); showMaximized(); raise(); KOPrefs::instance()->mLastSyncedLocalFile = fileName ; mSyncManager->slotSyncMenu( 1002 ); return; } if ( cmsg == "-writeFile" ) { // I made from the "-writeFile" an "-writeAlarm" mView->viewManager()->showWhatsNextView(); mCalendar->checkAlarmForIncidence( 0, true); showMaximized(); raise(); return; } if ( cmsg == "-writeFileSilent" ) { // I made from the "-writeFile" an "-writeAlarm" // mView->viewManager()->showWhatsNextView(); mCalendar->checkAlarmForIncidence( 0, true); //showMaximized(); //raise(); hide(); return; } if ( cmsg == "-newCountdown" ) { qDebug("newCountdown "); } QString msg ; QString allmsg = cmsg; while ( allmsg.length() > 0 ) { int nextC = allmsg.find( "-", 1 ); if ( nextC == -1 ) { msg = allmsg; allmsg = ""; } else{ msg = allmsg.left( nextC ); allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); } //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); if ( msg == "-newEvent" ) { mView->newEvent(); } if ( msg == "-newTodo" ) { mView->newTodo(); } if ( msg == "-showWN" ) { mView->viewManager()->showWhatsNextView(); } if ( msg == "-showTodo" ) { mView->viewManager()->showTodoView(); } if ( msg == "-showList" ) { mView->viewManager()->showListView(); } else if ( msg == "-showDay" ) { mView->viewManager()->showDayView(); } else if ( msg == "-showWWeek" ) { mView->viewManager()->showWorkWeekView(); } else if ( msg == "-ringSync" ) { mSyncManager->multiSync( false ); } else if ( msg == "-showWeek" ) { mView->viewManager()->showWeekView(); } else if ( msg == "-showTodo" ) { mView->viewManager()->showTodoView(); } else if ( msg == "-showJournal" ) { mView->dateNavigator()->selectDates( 1 ); mView->dateNavigator()->selectToday(); mView->viewManager()->showJournalView(); } else if ( msg == "-showKO" ) { mView->viewManager()->showNextXView(); } else if ( msg == "-showWNext" || msg == "nextView()" ) { mView->viewManager()->showWhatsNextView(); } else if ( msg == "-showNextXView" ) { mView->viewManager()->showNextXView(); } } showMaximized(); raise(); } QPixmap MainWindow::loadPixmap( QString name ) { return SmallIcon( name ); } void MainWindow::initActions() { //KOPrefs::instance()->mShowFullMenu iconToolBar->clear(); KOPrefs *p = KOPrefs::instance(); //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); QPopupMenu *viewMenu = new QPopupMenu( this ); QPopupMenu *actionMenu = new QPopupMenu( this ); QPopupMenu *importMenu = new QPopupMenu( this ); + QPopupMenu *importMenu_X = new QPopupMenu( this ); + QPopupMenu *exportMenu_X = new QPopupMenu( this ); + QPopupMenu *beamMenu_X = new QPopupMenu( this ); selectFilterMenu = new QPopupMenu( this ); selectFilterMenu->setCheckable( true ); syncMenu = new QPopupMenu( this ); configureAgendaMenu = new QPopupMenu( this ); configureToolBarMenu = new QPopupMenu( this ); QPopupMenu *helpMenu = new QPopupMenu( this ); - QIconSet icon; int pixWid = 22, pixHei = 22; QString pathString = ""; if ( !p->mToolBarMiniIcons ) { if ( QApplication::desktop()->width() < 480 ) { pathString += "icons16/"; pixWid = 18; pixHei = 16; } } else { pathString += "iconsmini/"; pixWid = 18; pixHei = 16; } if ( KOPrefs::instance()->mShowFullMenu ) { QMenuBar *menuBar1; menuBar1 = menuBar(); menuBar1->insertItem( i18n("File"), importMenu ); menuBar1->insertItem( i18n("View"), viewMenu ); menuBar1->insertItem( i18n("Actions"), actionMenu ); #ifdef DESKTOP_VERSION menuBar1->insertItem( i18n("Synchronize"), syncMenu ); menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); #else menuBar1->insertItem( i18n("Sync"), syncMenu ); menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); #endif //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); menuBar1->insertItem( i18n("Help"), helpMenu ); } else { QPEMenuBar *menuBar1; menuBar1 = new QPEMenuBar( iconToolBar ); QPopupMenu *menuBar = new QPopupMenu( this ); icon = loadPixmap( pathString + "z_menu" ); menuBar1->insertItem( icon.pixmap(), menuBar); //menuBar1->insertItem( i18n("ME"), menuBar); menuBar->insertItem( i18n("File"), importMenu ); menuBar->insertItem( i18n("View"), viewMenu ); menuBar->insertItem( i18n("Actions"), actionMenu ); menuBar->insertItem( i18n("Synchronize"), syncMenu ); menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); menuBar->insertItem( i18n("Filter"),selectFilterMenu ); menuBar->insertItem( i18n("Help"), helpMenu ); //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); menuBar1->setMaximumSize( menuBar1->sizeHint( )); } connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); mWeekBgColor = iconToolBar->backgroundColor(); mWeekPixmap.resize( pixWid , pixHei ); mWeekPixmap.fill( mWeekBgColor ); icon = mWeekPixmap; mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); if ( p-> mShowIconWeekNum ) mWeekAction->addTo( iconToolBar ); mWeekFont = font(); int fontPoint = mWeekFont.pointSize(); QFontMetrics f( mWeekFont ); int fontWid = f.width( "30" ); while ( fontWid > pixWid ) { --fontPoint; mWeekFont.setPointSize( fontPoint ); QFontMetrics f( mWeekFont ); fontWid = f.width( "30" ); qDebug("dec-- "); } connect( mWeekAction, SIGNAL( activated() ), this, SLOT( weekAction() ) ); connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); //#endif // ****************** QAction *action; // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); configureToolBarMenu->setCheckable( true ); configureAgendaMenu->setCheckable( true ); int iii ; for ( iii = 1;iii<= 10 ;++iii ){ configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); } //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); connect( configureAgendaMenu, SIGNAL( aboutToShow()), this, SLOT( showConfigureAgenda( ) ) ); icon = loadPixmap( pathString + "configure" ); action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); action->addTo( actionMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( edit_options() ) ); actionMenu->insertSeparator(); action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); action->addTo( actionMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( undo_delete() ) ); actionMenu->insertSeparator(); icon = loadPixmap( pathString + "newevent" ); configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); configureToolBarMenu->insertSeparator(); configureToolBarMenu->insertItem(i18n("Week Number"), 400); configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); ne_action->addTo( actionMenu ); connect( ne_action, SIGNAL( activated() ), mView, SLOT( newEvent() ) ); icon = loadPixmap( pathString + "newtodo" ); configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); nt_action->addTo( actionMenu ); connect( nt_action, SIGNAL( activated() ), mView, SLOT( newTodo() ) ); icon = loadPixmap( pathString + "today" ); QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); today_action->addTo( viewMenu ); connect( today_action, SIGNAL( activated() ), mView, SLOT( goToday() ) ); viewMenu->insertSeparator(); icon = loadPixmap( pathString + "navi" ); action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); action->addTo( viewMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( toggleDateNavigatorWidget() ) ); mToggleNav = action ; icon = loadPixmap( pathString + "filter" ); action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); action->addTo( viewMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( toggleFilter() ) ); mToggleFilter = action; icon = loadPixmap( pathString + "allday" ); action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); action->addTo( viewMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( toggleAllDaySize() ) ); mToggleAllday = action; connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), mToggleNav, SLOT( setEnabled ( bool ) ) ); connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), mToggleFilter, SLOT( setEnabled ( bool ) ) ); connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), mToggleAllday, SLOT( setEnabled ( bool ) ) ); viewMenu->insertSeparator(); icon = loadPixmap( pathString + "picker" ); action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); action->addTo( viewMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( showDatePicker() ) ); action->addTo( iconToolBar ); viewMenu->insertSeparator(); icon = loadPixmap( pathString + "list" ); configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); showlist_action->addTo( viewMenu ); connect( showlist_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showListView() ) ); icon = loadPixmap( pathString + "day" ); configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); day1_action->addTo( viewMenu ); // action->addTo( toolBar ); connect( day1_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showDayView() ) ); icon = loadPixmap( pathString + "workweek" ); configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); day5_action->addTo( viewMenu ); connect( day5_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showWorkWeekView() ) ); icon = loadPixmap( pathString + "week" ); configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); day7_action->addTo( viewMenu ); connect( day7_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showWeekView() ) ); icon = loadPixmap( pathString + "workweek2" ); configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); day6_action->addTo( viewMenu ); connect( day6_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showMonthViewWeek() ) ); icon = loadPixmap( pathString + "month" ); configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); month_action->addTo( viewMenu ); connect( month_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showMonthView() ) ); icon = loadPixmap( pathString + "todo" ); configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); todoview_action->addTo( viewMenu ); connect( todoview_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showTodoView() ) ); icon = loadPixmap( pathString + "journal" ); configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); viewjournal_action->addTo( viewMenu ); connect( viewjournal_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showJournalView() ) ); icon = loadPixmap( pathString + "xdays" ); configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); xdays_action->addTo( viewMenu ); connect( xdays_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showNextXView() ) ); icon = loadPixmap( pathString + "whatsnext" ); configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); whatsnext_action->addTo( viewMenu ); connect( whatsnext_action, SIGNAL( activated() ), mView->viewManager(), SLOT( showWhatsNextView() ) ); #if 0 action = new QAction( "view_timespan", "Time Span", 0, this ); action->addTo( viewMenu ); connect( action, SIGNAL( activated() ), mView->viewManager(), SLOT( showTimeSpanView() ) ); #endif mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, this ); mNewSubTodoAction->addTo( actionMenu ); connect( mNewSubTodoAction, SIGNAL( activated() ), mView, SLOT( newSubTodo() ) ); actionMenu->insertSeparator(); mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); mShowAction->addTo( actionMenu ); connect( mShowAction, SIGNAL( activated() ), mView, SLOT( showIncidence() ) ); mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); mEditAction->addTo( actionMenu ); connect( mEditAction, SIGNAL( activated() ), mView, SLOT( editIncidence() ) ); mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); mDeleteAction->addTo( actionMenu ); connect( mDeleteAction, SIGNAL( activated() ), mView, SLOT( deleteIncidence() ) ); mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); mCloneAction->addTo( actionMenu ); connect( mCloneAction, SIGNAL( activated() ), mView, SLOT( cloneIncidence() ) ); mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); mMoveAction->addTo( actionMenu ); connect( mMoveAction, SIGNAL( activated() ), mView, SLOT( moveIncidence() ) ); mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); mBeamAction->addTo( actionMenu ); connect( mBeamAction, SIGNAL( activated() ), mView, SLOT( beamIncidence() ) ); mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); mCancelAction->addTo( actionMenu ); connect( mCancelAction, SIGNAL( activated() ), mView, SLOT( toggleCancelIncidence() ) ); actionMenu->insertSeparator(); action = new QAction( "purge_completed", i18n("Purge Completed"), 0, this ); action->addTo( actionMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); icon = loadPixmap( pathString + "search" ); QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); search_action->addTo( actionMenu ); connect( search_action, SIGNAL( activated() ), mView->dialogManager(), SLOT( showSearchDialog() ) ); if ( KOPrefs::instance()->mShowFullMenu ) { actionMenu->insertSeparator(); actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); } // actionMenu->insertSeparator(); action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, this ); - action->addTo( importMenu ); + action->addTo( importMenu_X ); connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); action = new QAction( "import_quick", i18n("Import last file"), 0, this ); - action->addTo( importMenu ); + action->addTo( importMenu_X ); connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); - importMenu->insertSeparator(); + importMenu_X->insertSeparator(); action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, this ); - action->addTo( importMenu ); + action->addTo( importMenu_X ); connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); //#ifndef DESKTOP_VERSION - importMenu->insertSeparator(); + importMenu_X->insertSeparator(); action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, this ); - action->addTo( importMenu ); + action->addTo( importMenu_X ); connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); //#else #ifdef _OL_IMPORT_ - importMenu->insertSeparator(); + importMenu_X->insertSeparator(); action = new QAction( "import_ol", i18n("Import from OL"), 0, this ); - action->addTo( importMenu ); + action->addTo( importMenu_X ); connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); #endif //#endif - importMenu->insertSeparator(); + //importMenu->insertSeparator(); action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); - importMenu->insertSeparator(); + importMenu->insertItem( i18n("Import"), importMenu_X ); + //importMenu->insertSeparator(); action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, this ); - action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); + action->addTo( exportMenu_X ); + connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); //LR QPopupMenu *ex2phone = new QPopupMenu( this ); ex2phone->insertItem(i18n("Complete calendar..."), 1 ); ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); - importMenu->insertItem( i18n("Export to phone"), ex2phone ); + exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); - importMenu->insertSeparator(); - action = new QAction( "manage cat", i18n("Manage new categories..."), 0, - this ); - action->addTo( importMenu ); - connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); + importMenu->insertItem( i18n("Export"), exportMenu_X ); #ifndef DESKTOP_VERSION - importMenu->insertSeparator(); + //importMenu->insertSeparator(); brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, this ); - brAction->addTo( importMenu ); + brAction->addTo( beamMenu_X ); brAction->setToggleAction (true ) ; connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, this ); - action->addTo( importMenu ); + action->addTo( beamMenu_X ); connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, this ); - action->addTo( importMenu ); + action->addTo( beamMenu_X ); connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); + importMenu->insertItem( i18n("Beam"), beamMenu_X ); #else - importMenu->insertSeparator(); + //importMenu->insertSeparator(); icon = loadPixmap( pathString + "print" ); action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); - action->addTo( importMenu ); + action->addTo( beamMenu_X ); connect( action, SIGNAL( activated() ), this, SLOT( printCal() ) ); icon = loadPixmap( pathString + "print" ); action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); - action->addTo( importMenu ); + action->addTo( beamMenu_X ); connect( action, SIGNAL( activated() ), this, SLOT( printSel() ) ); action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); - action->addTo( importMenu ); + action->addTo( beamMenu_X ); connect( action, SIGNAL( activated() ), mView->viewManager(), SIGNAL( printWNV() ) ); + importMenu->insertItem( i18n("Print"), beamMenu_X ); #endif importMenu->insertSeparator(); + action = new QAction( "manage cat", i18n("Manage new categories..."), 0, + this ); + action->addTo( importMenu ); + connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); + importMenu->insertSeparator(); action = new QAction( "beam all", i18n("Save"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); action = new QAction( "beam all", i18n("Exit (+save)"), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); //menuBar->insertItem( "Configure",configureMenu ); //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); icon = loadPixmap( "korganizer/korganizer" ); action = new QAction( "Whats New", i18n("What's new?"), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( whatsNew() ) ); action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( features() ) ); action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( keyBindings() ) ); action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( synchowto() ) ); action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( kdesynchowto() ) ); action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( multisynchowto() ) ); action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( aboutAutoSaving() ) ); action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( aboutKnownBugs() ) ); action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( usertrans() ) ); action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( faq() ) ); action = new QAction( "licence", i18n("Licence..."), 0, this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( licence() ) ); action = new QAction( "about", i18n("About..."), 0, this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( about() ) ); //menuBar->insertSeparator(); // ****************************************************** // menubar icons iconToolBar->setHorizontalStretchable (true ); //menuBar->insertItem( iconToolBar ); //xdays_action if (p-> mShowIconNewEvent) ne_action->addTo( iconToolBar ); if (p->mShowIconNewTodo ) nt_action->addTo( iconToolBar ); if (p-> mShowIconSearch) search_action->addTo( iconToolBar ); if (p-> mShowIconNext) whatsnext_action->addTo( iconToolBar ); if (p-> mShowIconNextDays) xdays_action->addTo( iconToolBar ); if (p-> mShowIconList) showlist_action->addTo( iconToolBar ); if (p-> mShowIconDay1) day1_action->addTo( iconToolBar ); if (p-> mShowIconDay5) day5_action->addTo( iconToolBar ); if (p-> mShowIconDay7) day7_action->addTo( iconToolBar ); if (p-> mShowIconDay6) day6_action->addTo( iconToolBar ); if (p-> mShowIconMonth) month_action->addTo( iconToolBar ); if (p-> mShowIconTodoview) todoview_action->addTo( iconToolBar ); if (p-> mShowIconJournal) viewjournal_action->addTo( iconToolBar ); icon = loadPixmap( pathString + "2leftarrowB" ); configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); if (p-> mShowIconBackFast) { action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); connect( action, SIGNAL( activated() ), mView, SLOT( goPreviousMonth() ) ); action->addTo( iconToolBar ); } icon = loadPixmap( pathString + "1leftarrowB" ); configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); if (p-> mShowIconBack) { action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); connect( action, SIGNAL( activated() ), mView, SLOT( goPrevious() ) ); action->addTo( iconToolBar ); } icon = loadPixmap( pathString + "today" ); configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); if (p-> mShowIconToday) today_action->addTo( iconToolBar ); icon = loadPixmap( pathString + "1rightarrowB" ); configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); if (p-> mShowIconForward) { action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); connect( action, SIGNAL( activated() ), mView, SLOT( goNext() ) ); action->addTo( iconToolBar ); } icon = loadPixmap( pathString + "2rightarrowB" ); configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); if (p-> mShowIconForwardFast) { action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); connect( action, SIGNAL( activated() ), mView, SLOT( goNextMonth() ) ); action->addTo( iconToolBar ); } configureToolBarMenu->insertItem(i18n("What's This?"), 300); if (p-> mShowIconNewEvent) configureToolBarMenu->setItemChecked( 10, true ); if (p->mShowIconNewTodo ) configureToolBarMenu->setItemChecked( 20, true ); if (p-> mShowIconSearch) configureToolBarMenu->setItemChecked( 120, true ); if (p-> mShowIconList) configureToolBarMenu->setItemChecked( 30, true ); if (p-> mShowIconDay1) configureToolBarMenu->setItemChecked( 40, true ); if (p-> mShowIconDay5) configureToolBarMenu->setItemChecked( 50, true ); if (p-> mShowIconDay6) configureToolBarMenu->setItemChecked( 75, true ); if (p-> mShowIconDay7) configureToolBarMenu->setItemChecked( 60, true ); if (p-> mShowIconMonth) configureToolBarMenu->setItemChecked( 70, true ); if (p-> mShowIconTodoview) configureToolBarMenu->setItemChecked( 80, true ); if (p-> mShowIconBackFast) configureToolBarMenu->setItemChecked( 200, true ); if (p-> mShowIconBack) configureToolBarMenu->setItemChecked( 210, true ); if (p-> mShowIconToday) configureToolBarMenu->setItemChecked( 130, true ); if (p-> mShowIconForward) configureToolBarMenu->setItemChecked( 220, true ); if (p-> mShowIconForwardFast) configureToolBarMenu->setItemChecked( 230, true ); if (p-> mShowIconNextDays) configureToolBarMenu->setItemChecked( 100, true ); if (p-> mShowIconNext) configureToolBarMenu->setItemChecked( 110, true ); if (p-> mShowIconJournal) configureToolBarMenu->setItemChecked( 90, true ); if (p-> mShowIconWhatsThis) configureToolBarMenu->setItemChecked( 300, true ); if (p-> mShowIconWeekNum) configureToolBarMenu->setItemChecked( 400, true ); QLabel* dummy = new QLabel( iconToolBar ); dummy->setBackgroundColor( iconToolBar->backgroundColor() ); if (!p-> mShowIconStretch) iconToolBar->setStretchableWidget ( dummy ) ; else configureToolBarMenu->setItemChecked( 5, true ); if (p-> mShowIconWhatsThis) QWhatsThis::whatsThisButton ( iconToolBar ); connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); configureAgenda( p->mHourSize ); connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); } void MainWindow::exportToPhone( int mode ) { //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); KOex2phonePrefs ex2phone; ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); if ( mode == 1 ) ex2phone.setCaption(i18n("Export complete calendar")); if ( mode == 2 ) ex2phone.setCaption(i18n("Export filtered calendar")); if ( !ex2phone.exec() ) { return; } KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); int inFuture = 0; if ( ex2phone.mWriteBackFuture->isChecked() ) inFuture = ex2phone.mWriteBackFutureWeeks->value(); QPtrList<Incidence> delSel; if ( mode == 1 ) delSel = mCalendar->rawIncidences(); if ( mode == 2 ) delSel = mCalendar->incidences(); CalendarLocal* cal = new CalendarLocal(); cal->setLocalTime(); Incidence *incidence = delSel.first(); QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); while ( incidence ) { if ( incidence->type() != "Journal" ) { bool add = true; if ( inFuture ) { QDateTime dt; if ( incidence->type() == "Todo" ) { Todo * t = (Todo*)incidence; if ( t->hasDueDate() ) dt = t->dtDue(); else dt = cur.addSecs( 62 ); } else { bool ok; dt = incidence->getNextOccurence( cur, &ok ); if ( !ok ) dt = cur.addSecs( -62 ); } if ( dt < cur || dt > end ) { add = false; } } if ( add ) { Incidence *in = incidence->clone(); cal->addIncidence( in ); } } incidence = delSel.next(); } PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, KPimGlobalPrefs::instance()->mEx2PhoneConnection, KPimGlobalPrefs::instance()->mEx2PhoneModel ); setCaption( i18n("Writing to phone...")); if ( PhoneFormat::writeToPhone( cal ) ) setCaption( i18n("Export to phone successful!")); else setCaption( i18n("Error exporting to phone!")); delete cal; } void MainWindow::setDefaultPreferences() { KOPrefs *p = KOPrefs::instance(); p->mCompactDialogs = true; p->mConfirm = true; // p->mEnableQuickTodo = false; } QString MainWindow::resourcePath() { return KGlobal::iconLoader()->iconPath(); } void MainWindow::displayText( QString text ,QString cap ) { QDialog dia( this, "name", true ); ; dia.setCaption( cap ); QVBoxLayout* lay = new QVBoxLayout( &dia ); lay->setSpacing( 3 ); lay->setMargin( 3 ); QTextBrowser tb ( &dia ); lay->addWidget( &tb ); tb.setText( text ); #ifdef DESKTOP_VERSION dia.resize( 640, 480); #else dia.showMaximized(); #endif dia.exec(); } void MainWindow::features() { KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); } void MainWindow::usertrans() { KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); } void MainWindow::kdesynchowto() { KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); } void MainWindow::multisynchowto() { KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); } void MainWindow::synchowto() { KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); } void MainWindow::faq() { KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); } void MainWindow::whatsNew() { KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); } void MainWindow::licence() { KApplication::showLicence(); } void MainWindow::about() { QString version; #include <../version> QMessageBox::about( this, i18n("About KOrganizer/Pi"), i18n("KOrganizer/Platform-independent\n") + "(KO/Pi) " + version + " - " + #ifdef DESKTOP_VERSION i18n("Desktop Edition\n") + #else i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + #endif i18n("(c)2004 Lutz Rogowski (rogowski@kde.org)\nKO/Pi is based on KOrganizer\n(c)2002,2003 Cornelius Schumacher\n(schumacher@kde.org) and the KDE team.\nKOrganizer/Pi is licensed under the GPL.\nKO/Pi can be compiled for\nLinux, Zaurus-PDA and Windows\nwww.pi-sync.net --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); } void MainWindow::keyBindings() { QString cap = i18n("KO/Pi Keys + Colors"); QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ i18n("<p><h3>In agenda view:</h3></p>\n") + i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ i18n("<p><h3>In todo view:</h3></p>\n") + i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |