author | ulf69 <ulf69> | 2004-08-17 00:13:25 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-17 00:13:25 (UTC) |
commit | f3875aba68f175e8da32462f64b12fc46bc31102 (patch) (side-by-side diff) | |
tree | c17a6e839a27ddfdc80699739e9934327a4a8610 | |
parent | ab3b10a5018152dedbdb64d0d5a4bd8ec752ccdb (diff) | |
download | kdepimpi-f3875aba68f175e8da32462f64b12fc46bc31102.zip kdepimpi-f3875aba68f175e8da32462f64b12fc46bc31102.tar.gz kdepimpi-f3875aba68f175e8da32462f64b12fc46bc31102.tar.bz2 |
added listener for reults of Ka/Pi
-rw-r--r-- | korganizer/mainwindow.cpp | 500 |
1 files changed, 258 insertions, 242 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 6c0aa9b..4b00062 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp @@ -10,19 +10,20 @@ #include <qdir.h> #include <qapp.h> #include <qfileinfo.h> #include <qlabel.h> -#include <qwmatrix.h> -#include <qtextbrowser.h> -#include <qtextstream.h> +#include <qmap.h> +#include <qwmatrix.h> +#include <qtextbrowser.h> +#include <qtextstream.h> #ifndef DESKTOP_VERSION #include <qpe/global.h> #include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #include <qpe/resource.h> #include <qpe/qpeapplication.h> -#include <qtopia/alarmserver.h> -#include <qtopia/qcopenvelope_qws.h> +#include <qtopia/alarmserver.h> +#include <qtopia/qcopenvelope_qws.h> #else #include <qmenubar.h> #include <qtoolbar.h> #include <qapplication.h> @@ -50,9 +51,11 @@ #include "kglobal.h" #include "klocale.h" #include "kconfig.h" #include "simplealarmclient.h" -using namespace KCal; +#include "externalapphandler.h" + +using namespace KCal; #ifndef _WIN32_ #include <unistd.h> #else #include "koimportoldialog.h" @@ -65,13 +68,13 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : { #ifdef DESKTOP_VERSION setFont( QFont("Arial"), 14 ); -#endif +#endif //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; QString confFile = locateLocal("config","korganizerrc"); - QFileInfo finf ( confFile ); + QFileInfo finf ( confFile ); bool showWarning = !finf.exists(); setIcon(SmallIcon( "ko24" ) ); mBlockAtStartup = true; mFlagKeyPressed = false; @@ -79,9 +82,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : KOPrefs *p = KOPrefs::instance(); // if ( QApplication::desktop()->height() > 480 ) { // if ( p->mHourSize == 4 ) // p->mHourSize = 6; -// } +// } if ( p->mHourSize > 18 ) p->mHourSize = 18; QMainWindow::ToolBarDock tbd; if ( p->mToolBarHor ) { @@ -101,10 +104,10 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : globalFlagBlockStartup = 1; iconToolBar = new QPEToolBar( this ); addToolBar (iconToolBar , tbd ); mBlockSaveFlag = false; - mCalendarModifiedFlag = false; - + mCalendarModifiedFlag = false; + QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); splash->setAlignment ( AlignCenter ); setCentralWidget( splash ); #ifndef DESKTOP_VERSION @@ -115,11 +118,11 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : mCalendar = new CalendarLocal(); mView = new CalendarView( mCalendar, this,"mCalendar " ); mView->hide(); //mView->resize(splash->size() ); - initActions(); + initActions(); #ifndef DESKTOP_VERSION - iconToolBar->show(); + 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() ; @@ -132,9 +135,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : } //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(); + mView->readSettings(); bool oldOpened = false; bool newFile = false; if( !QFile::exists( defaultFileName() ) ) { QFileInfo finfo ( defaultFileName() ); @@ -147,14 +150,14 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : mView->openCalendar( oldFile ); qApp->processEvents(); } else { oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); - finfo.setFile( oldFile ); + finfo.setFile( oldFile ); if (finfo.exists() ) { KMessageBox::information( this, message); mView->openCalendar( oldFile ); qApp->processEvents(); - } + } } mView->saveCalendar( defaultFileName() ); newFile = true; } @@ -174,47 +177,50 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), SLOT( processIncidenceSelection( Incidence * ) ) ); connect( mView, SIGNAL( modifiedChanged( bool ) ), SLOT( slotModifiedChanged( bool ) ) ); - + connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); mView->setModified( false ); mBlockAtStartup = false; mView->setModified( false ); setCentralWidget( mView ); globalFlagBlockStartup = 0; mView->show(); - delete splash; + 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(); + fillSyncMenu(); mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); if ( showWarning ) { - KMessageBox::information( this, + 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 + connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); } MainWindow::~MainWindow() { //qDebug("MainWindow::~MainWindow() "); - //save toolbar location - - delete mCalendar; + //save toolbar location + + delete mCalendar; delete KOPrefs::instance(); delete KIncidenceFormatter::instance(); - - + + } void MainWindow::closeEvent( QCloseEvent* ce ) { - - - + + + if ( ! KOPrefs::instance()->mAskForQuit ) { saveOnClose(); ce->accept(); return; @@ -222,19 +228,19 @@ void MainWindow::closeEvent( QCloseEvent* ce ) } switch( QMessageBox::information( this, "KO/Pi", i18n("Do you really want\nto close KO/Pi?"), - i18n("Close"), i18n("No"), + i18n("Close"), i18n("No"), 0, 0 ) ) { case 0: saveOnClose(); ce->accept(); break; case 1: - ce->ignore(); + ce->ignore(); break; case 2: - + default: break; } @@ -247,29 +253,39 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); //QString datamess; //qDebug("message "); qDebug("KO: QCOP message received: %s ", cmsg.data() ); + + if ( cmsg == "-writeFile" ) { + // I made from the "-writeFile" an "-writeAlarm" + mView->viewManager()->showWhatsNextView(); + mCalendar->checkAlarmForIncidence( 0, true); + showMaximized(); + raise(); + return; + } + if ( cmsg == "-writeFile" ) { // I made from the "-writeFile" an "-writeAlarm" - mView->viewManager()->showWhatsNextView(); + mView->viewManager()->showWhatsNextView(); mCalendar->checkAlarmForIncidence( 0, true); showMaximized(); raise(); return; - + } if ( cmsg == "-writeFileSilent" ) { // I made from the "-writeFile" an "-writeAlarm" - // mView->viewManager()->showWhatsNextView(); + // 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 ) { @@ -286,10 +302,10 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) mView->newEvent(); } if ( msg == "-newTodo" ) { mView->newTodo(); - - } + + } if ( msg == "-showWN" ) { mView->viewManager()->showWhatsNextView(); } if ( msg == "-showTodo" ) { @@ -322,13 +338,13 @@ void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) mView->viewManager()->showNextXView(); } else if ( msg == "-showWNext" || msg == "nextView()" ) { mView->viewManager()->showWhatsNextView(); - } + } else if ( msg == "-showNextXView" ) { mView->viewManager()->showNextXView(); } - + } showMaximized(); @@ -350,9 +366,9 @@ void MainWindow::initActions() QPopupMenu *viewMenu = new QPopupMenu( this ); QPopupMenu *actionMenu = new QPopupMenu( this ); QPopupMenu *importMenu = new QPopupMenu( this ); selectFilterMenu = new QPopupMenu( this ); - selectFilterMenu->setCheckable( true ); + selectFilterMenu->setCheckable( true ); syncMenu = new QPopupMenu( this ); configureAgendaMenu = new QPopupMenu( this ); configureToolBarMenu = new QPopupMenu( this ); QPopupMenu *helpMenu = new QPopupMenu( this ); @@ -362,26 +378,26 @@ void MainWindow::initActions() menuBar1->insertItem( i18n("File"), importMenu ); menuBar1->insertItem( i18n("View"), viewMenu ); menuBar1->insertItem( i18n("Actions"), actionMenu ); menuBar1->insertItem( i18n("Synchronize"), syncMenu ); - menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); - //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); - menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); - menuBar1->insertItem( i18n("Help"), helpMenu ); - } else { + menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); + //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 ); 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() ); + 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 ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); @@ -392,58 +408,58 @@ void MainWindow::initActions() QIconSet icon; // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); configureToolBarMenu->setCheckable( true ); - QString pathString = ""; + QString pathString = ""; if ( !p->mToolBarMiniIcons ) { - if ( QApplication::desktop()->width() < 480 ) + if ( QApplication::desktop()->width() < 480 ) pathString += "icons16/"; } else pathString += "iconsmini/"; configureAgendaMenu->setCheckable( true ); - configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); - configureAgendaMenu->insertSeparator(); - configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); + configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); + configureAgendaMenu->insertSeparator(); + configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); configureAgendaMenu->insertItem(i18n("Small"), 6 ); configureAgendaMenu->insertItem(i18n("Medium"), 8 ); - configureAgendaMenu->insertItem(i18n("Normal"), 10 ); - configureAgendaMenu->insertItem(i18n("Large"), 12 ); - configureAgendaMenu->insertItem(i18n("Big"), 14 ); - configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); - configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); - //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); - - icon = loadPixmap( pathString + "configure" ); + configureAgendaMenu->insertItem(i18n("Normal"), 10 ); + configureAgendaMenu->insertItem(i18n("Large"), 12 ); + configureAgendaMenu->insertItem(i18n("Big"), 14 ); + configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); + configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); + //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); + + 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(); - icon = loadPixmap( pathString + "newevent" ); - configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); - configureToolBarMenu->insertSeparator(); + icon = loadPixmap( pathString + "newevent" ); + configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); + configureToolBarMenu->insertSeparator(); 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 ); + 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 + "navi" ); + 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() ) ); - icon = loadPixmap( pathString + "filter" ); + 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() ) ); - + viewMenu->insertSeparator(); icon = loadPixmap( pathString + "picker" ); action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); @@ -451,73 +467,73 @@ void MainWindow::initActions() connect( action, SIGNAL( activated() ), mView, SLOT( showDatePicker() ) ); action->addTo( iconToolBar ); viewMenu->insertSeparator(); - icon = loadPixmap( pathString + "list" ); - configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); + 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 ); + 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 ); + 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 ); + 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 + "month" ); - configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); + 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 ); + 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 ); + 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 ); + 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 ); + 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() ), @@ -553,26 +569,26 @@ void MainWindow::initActions() this ); action->addTo( actionMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); - icon = loadPixmap( pathString + "search" ); + icon = loadPixmap( pathString + "search" ); QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); - configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); + configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); search_action->addTo( actionMenu ); connect( search_action, SIGNAL( activated() ), mView->dialogManager(), SLOT( showSearchDialog() ) ); - icon = loadPixmap( pathString + "today" ); - configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); + icon = loadPixmap( pathString + "today" ); + configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); today_action->addTo( actionMenu ); connect( today_action, SIGNAL( activated() ), mView, SLOT( goToday() ) ); if ( KOPrefs::instance()->mShowFullMenu ) { actionMenu->insertSeparator(); - actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); - + actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); + } // actionMenu->insertSeparator(); action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, this ); @@ -628,22 +644,22 @@ void MainWindow::initActions() action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); - + action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); #else - importMenu->insertSeparator(); - icon = loadPixmap( pathString + "print" ); + importMenu->insertSeparator(); + icon = loadPixmap( pathString + "print" ); action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), this, SLOT( printCal() ) ); - - icon = loadPixmap( pathString + "print" ); + + icon = loadPixmap( pathString + "print" ); action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); action->addTo( importMenu ); connect( action, SIGNAL( activated() ), this, SLOT( printSel() ) ); @@ -656,45 +672,45 @@ void MainWindow::initActions() 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" ); + icon = loadPixmap( "korganizer/korganizer" ); action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), - SLOT( keyBindings() ) ); + SLOT( keyBindings() ) ); action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), - SLOT( features() ) ); + SLOT( features() ) ); action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), - SLOT( aboutAutoSaving() ) ); + SLOT( aboutAutoSaving() ) ); action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), - SLOT( aboutKnownBugs() ) ); + SLOT( aboutKnownBugs() ) ); action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), - SLOT( usertrans() ) ); + SLOT( usertrans() ) ); action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), - SLOT( synchowto() ) ); + SLOT( synchowto() ) ); action = new QAction( "Whats New", i18n("What's new?"), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), SLOT( whatsNew() ) ); action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), - SLOT( faq() ) ); - + SLOT( faq() ) ); + action = new QAction( "about", i18n("About..."), 0, this ); action->addTo( helpMenu ); connect( action, SIGNAL( activated() ), @@ -705,12 +721,12 @@ void MainWindow::initActions() SLOT( licence() ) ); //menuBar->insertSeparator(); // ****************************************************** - // menubar icons - - - iconToolBar->setHorizontalStretchable (true ); + // menubar icons + + + iconToolBar->setHorizontalStretchable (true ); //menuBar->insertItem( iconToolBar ); //xdays_action if (p-> mShowIconNewEvent) ne_action->addTo( iconToolBar ); @@ -736,44 +752,44 @@ void MainWindow::initActions() todoview_action->addTo( iconToolBar ); if (p-> mShowIconJournal) viewjournal_action->addTo( iconToolBar ); icon = loadPixmap( pathString + "2leftarrowB" ); - configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); + 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); + 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 ); } - if (p-> mShowIconToday) + if (p-> mShowIconToday) today_action->addTo( iconToolBar ); icon = loadPixmap( pathString + "1rightarrowB" ); - configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); + 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); + 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); + + + configureToolBarMenu->insertItem(i18n("What's This?"), 300); if (p-> mShowIconNewEvent) configureToolBarMenu->setItemChecked( 10, true ); if (p->mShowIconNewTodo ) @@ -793,12 +809,12 @@ void MainWindow::initActions() if (p-> mShowIconTodoview) configureToolBarMenu->setItemChecked( 80, true ); if (p-> mShowIconBackFast) configureToolBarMenu->setItemChecked( 200, true ); - if (p-> mShowIconBack) + if (p-> mShowIconBack) configureToolBarMenu->setItemChecked( 210, true ); if (p-> mShowIconToday) - configureToolBarMenu->setItemChecked( 130, true ); + configureToolBarMenu->setItemChecked( 130, true ); if (p-> mShowIconForward) configureToolBarMenu->setItemChecked( 220, true ); if (p-> mShowIconForwardFast) configureToolBarMenu->setItemChecked( 230, true ); @@ -818,9 +834,9 @@ void MainWindow::initActions() else configureToolBarMenu->setItemChecked( 5, true ); if (p-> mShowIconWhatsThis) QWhatsThis::whatsThisButton ( iconToolBar ); - connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); + connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); configureAgenda( p->mHourSize ); connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); } void MainWindow::fillSyncMenu() @@ -849,9 +865,9 @@ void MainWindow::fillSyncMenu() config.setGroup("General"); config.writeEntry("SyncProfileNames",prof); config.writeEntry("ExternSyncProfiles","Sharp_DTM"); config.sync(); - delete temp; + delete temp; } KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); KOPrefs::instance()->mSyncProfileNames = prof; int i; @@ -865,16 +881,16 @@ void MainWindow::fillSyncMenu() if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { syncMenu->setItemEnabled( false , 1000 ); } mView->setupExternSyncProfiles(); -} +} int MainWindow::ringSync() { int syncedProfiles = 0; - int i; + int i; QTime timer; - KConfig config ( locateLocal( "config","syncprofilesrc" ) ); + KConfig config ( locateLocal( "config","syncprofilesrc" ) ); QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; KSyncProfile* temp = new KSyncProfile (); KOPrefs::instance()->mAskForPreferences = false; for ( i = 0; i < syncProfileNames.count(); ++i ) { @@ -893,9 +909,9 @@ int MainWindow::ringSync() if ( i == 0 ) { syncSharp(); } else { if ( temp->getIsLocalFileSync() ) { - if ( syncWithFile( temp->getRemoteFileName( ), true ) ) + if ( syncWithFile( temp->getRemoteFileName( ), true ) ) KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); } else { if ( temp->getIsPhoneSync() ) { KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; @@ -903,9 +919,9 @@ int MainWindow::ringSync() KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); syncPhone(); } else syncRemote( temp, false ); - + } } timer.start(); setCaption(i18n("Multiple sync in progress ... please wait!") ); @@ -914,25 +930,25 @@ int MainWindow::ringSync() #ifndef _WIN32_ sleep (1); #endif } - + } } delete temp; return syncedProfiles; -} +} void MainWindow::multiSync( bool askforPrefs ) { if (mBlockSaveFlag) return; - mBlockSaveFlag = true; + mBlockSaveFlag = true; QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); if ( QMessageBox::information( this, i18n("KO/Pi Sync"), question, - i18n("Yes"), i18n("No"), + i18n("Yes"), i18n("No"), 0, 0 ) != 0 ) { mBlockSaveFlag = false; setCaption(i18n("Aborted! Nothing synced!")); return; @@ -949,9 +965,9 @@ void MainWindow::multiSync( bool askforPrefs ) if ( num > 1 ) ringSync(); mBlockSaveFlag = false; if ( num ) - save(); + save(); if ( num ) setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); else setCaption(i18n("Nothing synced! No profiles defined for multisync!")); @@ -964,21 +980,21 @@ void MainWindow::slotSyncMenu( int action ) confSync(); return; - } - if ( action == 1 ) { + } + if ( action == 1 ) { multiSync( true ); return; - } + } if (mBlockSaveFlag) return; mBlockSaveFlag = true; mCurrentSyncProfile = action - 1000 ; mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); - KConfig config ( locateLocal( "config","syncprofilesrc" ) ); + KConfig config ( locateLocal( "config","syncprofilesrc" ) ); KSyncProfile* temp = new KSyncProfile (); temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); temp->readConfig(&config); KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); @@ -996,9 +1012,9 @@ void MainWindow::slotSyncMenu( int action ) quickSyncLocalFile(); } else if ( action >= 1003 ) { if ( temp->getIsLocalFileSync() ) { - if ( syncWithFile( temp->getRemoteFileName( ), false ) ) + if ( syncWithFile( temp->getRemoteFileName( ), false ) ) KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); } else { if ( temp->getIsPhoneSync() ) { KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; @@ -1034,9 +1050,9 @@ void MainWindow::displayText( QString text ,QString cap ) QVBoxLayout* lay = new QVBoxLayout( &dia ); lay->setSpacing( 3 ); lay->setMargin( 3 ); QTextBrowser tb ( &dia ); - lay->addWidget( &tb ); + lay->addWidget( &tb ); tb.setText( text ); #ifdef DESKTOP_VERSION dia.resize( 640, 480); #else @@ -1046,17 +1062,17 @@ void MainWindow::displayText( QString text ,QString cap ) } void MainWindow::displayFile( QString fn, QString cap ) { QString fileName = resourcePath() + fn; - QString text; + QString text; QFile file( fileName ); if (!file.open( IO_ReadOnly ) ) { return ; - - } + + } QTextStream ts( &file ); text = ts.read(); - file.close(); + file.close(); displayText( text, cap); } void MainWindow::features() { @@ -1077,9 +1093,9 @@ void MainWindow::usertrans() #endif void MainWindow::synchowto() { #if 0 - QPtrList<Incidence> er = mCalendar->rawIncidences(); + QPtrList<Incidence> er = mCalendar->rawIncidences(); Incidence* inR = er.first(); VCalFormat vf; QString strout; while ( inR ) { @@ -1091,9 +1107,9 @@ void MainWindow::synchowto() inR = er.next(); } #endif displayFile( "howtoSYNC.txt",i18n("KO/Pi Synchronization HowTo") ); -} +} void MainWindow::faq() { displayFile( "kopiFAQ.txt",i18n("KO/Pi FAQ") ); @@ -1114,9 +1130,9 @@ void MainWindow::about() #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 / 8x0\n") + @@ -1174,9 +1190,9 @@ void MainWindow::keyBindings() i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + i18n("<p><b>White</b>: Item readonly</p>\n"); displayText( text, cap); - + } void MainWindow::aboutAutoSaving() { QMessageBox* msg; @@ -1186,10 +1202,10 @@ void MainWindow::aboutAutoSaving() QMessageBox::NoButton, QMessageBox::NoButton); msg->exec(); delete msg; - - + + } void MainWindow::aboutKnownBugs() { QMessageBox* msg; @@ -1204,9 +1220,9 @@ void MainWindow::aboutKnownBugs() QMessageBox::NoButton, QMessageBox::NoButton); msg->exec(); delete msg; - + } QString MainWindow::defaultFileName() { @@ -1216,45 +1232,45 @@ QString MainWindow::defaultFileName() void MainWindow::processIncidenceSelection( Incidence *incidence ) { if ( !incidence ) { enableIncidenceActions( false ); - - mNewSubTodoAction->setEnabled( false ); + + mNewSubTodoAction->setEnabled( false ); setCaptionToDates(); return; - + } - + //KGlobal::locale()->formatDateTime(nextA, true); QString startString = ""; - if ( incidence->type() != "Todo" ) { - if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { + if ( incidence->type() != "Todo" ) { + if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { if ( incidence->doesFloat() ) { - startString += ": "+incidence->dtStartDateStr( true ); - startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); + startString += ": "+incidence->dtStartDateStr( true ); + startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); } else { - startString = ": "+incidence->dtStartStr(true); + startString = ": "+incidence->dtStartStr(true); startString += " --- "+((Event*)incidence)->dtEndStr(true); } - + } else { if ( incidence->dtStart().time() != incidence->dtEnd().time() ) startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); - startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); + startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); } - + } - else + else startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); if ( !incidence->location().isEmpty() ) startString += " (" +incidence->location()+")"; setCaption( incidence->summary()+startString); - + enableIncidenceActions( true ); - + if ( incidence->type() == "Event" ) { mShowAction->setText( i18n("Show Event...") ); mEditAction->setText( i18n("Edit Event...") ); mDeleteAction->setText( i18n("Delete Event...") ); @@ -1291,18 +1307,18 @@ void MainWindow::importOL() mView->updateView(); #endif } void MainWindow::importBday() -{ +{ int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), i18n("Import!"), i18n("Cancel"), 0, 0, 1 ); if ( result == 0 ) { mView->importBday(); - + } - + } void MainWindow::importQtopia() { @@ -1322,11 +1338,11 @@ void MainWindow::importQtopia() i18n("Not supported \non desktop!\n"), i18n("Ok"), i18n("Cancel"), 0, 0, 1 ); -#endif +#endif } - + void MainWindow::saveOnClose() { KOPrefs *p = KOPrefs::instance(); p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); @@ -1340,9 +1356,9 @@ void MainWindow::slotModifiedChanged( bool changed ) { if ( mBlockAtStartup ) return; int msec; - // we store the changes after 1 minute, + // we store the changes after 1 minute, // and for safety reasons after 10 minutes again if ( !mBlockSaveFlag ) msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; else @@ -1353,9 +1369,9 @@ void MainWindow::slotModifiedChanged( bool changed ) } #include <qfileinfo.h> void MainWindow::save() { - if ( mBlockSaveFlag ) + if ( mBlockSaveFlag ) return; bool store = mBlockSaveFlag; mBlockSaveFlag = true; if ( mView->checkFileVersion( defaultFileName()) ) { @@ -1369,22 +1385,22 @@ void MainWindow::save() mView->setLoadedFileVersion(QDateTime::currentDateTime()); qDebug("KO: Needed %d ms for saving.",msNeeded ); QString savemes; savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); - setCaption(savemes); + setCaption(savemes); } else - setCaption(i18n("Saving cancelled!")); + setCaption(i18n("Saving cancelled!")); mCalendarModifiedFlag = false; mBlockSaveFlag = store; } -void MainWindow::keyReleaseEvent ( QKeyEvent * e) +void MainWindow::keyReleaseEvent ( QKeyEvent * e) { if ( !e->isAutoRepeat() ) { mFlagKeyPressed = false; } } -void MainWindow::keyPressEvent ( QKeyEvent * e ) +void MainWindow::keyPressEvent ( QKeyEvent * e ) { qApp->processEvents(); if ( e->isAutoRepeat() && !mFlagKeyPressed ) { e->ignore(); @@ -1417,9 +1433,9 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) mView->viewManager()->agendaView()->scrollOneHourDown(); break; case Qt::Key_Up: mView->viewManager()->agendaView()->scrollOneHourUp(); - break; + break; case Qt::Key_I: mView->showIncidence(); break; case Qt::Key_Delete: @@ -1439,9 +1455,9 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) case Qt::Key_3: case Qt::Key_4: case Qt::Key_5: case Qt::Key_6: - case Qt::Key_7: + case Qt::Key_7: case Qt::Key_8: case Qt::Key_9: pro = e->key()-48; if ( pro == 0 ) @@ -1458,9 +1474,9 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) break; case Qt::Key_S : if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) mView->newSubTodo(); - else + else mView->dialogManager()->showSearchDialog(); break; case Qt::Key_Y : case Qt::Key_Z : @@ -1475,40 +1491,40 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) keyBindings(); break; case Qt::Key_W: mView->viewManager()->showWhatsNextView(); - break; + break; case Qt::Key_L: mView->viewManager()->showListView(); - break; + break; case Qt::Key_N: mView->viewManager()->showNextXView(); showSelectedDates = true; - break; + break; case Qt::Key_V: mView->viewManager()->showTodoView(); - break; + break; case Qt::Key_C: mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); - break; + break; case Qt::Key_P: mView->showDatePicker( ); - break; - case Qt::Key_F: + break; + case Qt::Key_F: if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) mView->editFilters(); else mView->toggleFilter(); - break; + break; case Qt::Key_X: mView->toggleDateNavigatorWidget(); - break; + break; case Qt::Key_Space: mView->toggleExpand(); - break; + break; case Qt::Key_A: mView->toggleAllDaySize(); - break; + break; case Qt::Key_T: if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) mView->newTodo(); else { @@ -1521,10 +1537,10 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) break; case Qt::Key_B: mView->editIncidenceDescription();; break; - // case Qt::Key_Return: - case Qt::Key_E: + // case Qt::Key_Return: + case Qt::Key_E: if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) mView->newEvent(); else mView->editIncidence(); @@ -1538,9 +1554,9 @@ void MainWindow::keyPressEvent ( QKeyEvent * e ) size = p->mHourSize - 2; if ( size >= 4 ) configureAgenda( size ); break; - + default: e->ignore(); } @@ -1563,9 +1579,9 @@ void MainWindow::fillFilterMenu() else { selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 0 ); disable = true; } - selectFilterMenu->insertSeparator(); + selectFilterMenu->insertSeparator(); QPtrList<CalFilter> fili = mView->filters(); CalFilter *curfilter = mView->filterView()->selectedFilter(); CalFilter *filter = fili.first(); int iii = 1; @@ -1603,15 +1619,15 @@ void MainWindow::configureToolBar( int item ) p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); - p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); + p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); - p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); + p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); // initActions(); } void MainWindow::setCaptionToDates() @@ -1620,13 +1636,13 @@ void MainWindow::setCaptionToDates() selDates = KGlobal::locale()->formatDate(mView->startDate(), true); if (mView->startDate() < mView->endDate() ) selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); setCaption( i18n("Dates: ") + selDates ); - + } // parameter item == 0: reinit void MainWindow::configureAgenda( int item ) -{ +{ KOPrefs *p = KOPrefs::instance(); int i; @@ -1648,9 +1664,9 @@ void MainWindow::configureAgenda( int item ) mView->viewManager()->agendaView()->updateConfig(); } void MainWindow::saveCalendar() -{ +{ QString fn = KOPrefs::instance()->mLastSaveFile; fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); if ( fn == "" ) @@ -1658,9 +1674,9 @@ void MainWindow::saveCalendar() QFileInfo info; info.setFile( fn ); QString mes; bool createbup = true; - if ( info. exists() ) { + if ( info. exists() ) { mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, i18n("Overwrite!"), i18n("Cancel"), 0, 0, 1 ); @@ -1668,20 +1684,20 @@ void MainWindow::saveCalendar() createbup = false; } } if ( createbup ) { - mView->saveCalendar( fn ); + mView->saveCalendar( fn ); mes = i18n("KO/Pi:Saved %1").arg(fn); KOPrefs::instance()->mLastSaveFile = fn; setCaption(mes); } } void MainWindow::loadCalendar() { - + QString fn = KOPrefs::instance()->mLastLoadFile; fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); - + if ( fn == "" ) return; QFileInfo info; info.setFile( fn ); @@ -1725,11 +1741,11 @@ void MainWindow::importFile( QString fn, bool quick ) mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), mess ); return; - } + } int result = 0; - if ( !quick ) { + if ( !quick ) { mess = i18n( "Import file \n...%1\nfrom:\n%2\nDuplicated entries\nwill not be imported!\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); result = QMessageBox::warning( this, "KO/Pi: Warning!", mess, "Import", "Cancel", 0, @@ -1746,16 +1762,16 @@ void MainWindow::importFile( QString fn, bool quick ) } void MainWindow::importIcal() { - + QString fn =KOPrefs::instance()->mLastImportFile; fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); if ( fn == "" ) return; importFile( fn, true ); - + } void MainWindow::exportVCalendar() { @@ -1766,9 +1782,9 @@ void MainWindow::exportVCalendar() QFileInfo info; info.setFile( fn ); QString mes; bool createbup = true; - if ( info. exists() ) { + if ( info. exists() ) { mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, i18n("Overwrite!"), i18n("Cancel"), 0, 0, 1 ); @@ -1776,10 +1792,10 @@ void MainWindow::exportVCalendar() createbup = false; } } if ( createbup ) { - if ( mView->exportVCalendar( fn ) ) { - KOPrefs::instance()->mLastVcalFile = fn; + if ( mView->exportVCalendar( fn ) ) { + KOPrefs::instance()->mLastVcalFile = fn; if ( fn.length() > 20 ) mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; else mes = i18n("KO/Pi:Exported to %1").arg(fn ); @@ -1787,22 +1803,22 @@ void MainWindow::exportVCalendar() } } } -#include <qpushbutton.h> +#include <qpushbutton.h> QString MainWindow::getPassword( ) -{ +{ QString retfile = ""; - QDialog dia ( this, "input-dialog", true ); - QLineEdit lab ( &dia ); + QDialog dia ( this, "input-dialog", true ); + QLineEdit lab ( &dia ); lab.setEchoMode( QLineEdit::Password ); QVBoxLayout lay( &dia ); - lay.setMargin(7); - lay.setSpacing(7); + lay.setMargin(7); + lay.setSpacing(7); lay.addWidget( &lab); dia.setFixedSize( 230,50 ); dia.setCaption( i18n("Enter password") ); - QPushButton pb ( "OK", &dia); + QPushButton pb ( "OK", &dia); lay.addWidget( &pb ); connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); dia.show(); int res = dia.exec(); @@ -1843,21 +1859,21 @@ bool MainWindow::syncWithFile( QString fn , bool quick ) mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), mess ); return ret; - } + } int result = 0; - if ( !quick ) { + if ( !quick ) { mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), mess, i18n("Sync"), i18n("Cancel"), 0, 0, 1 ); - if ( result ) + if ( result ) return false; } if ( KOPrefs::instance()->mAskForPreferences ) - mView->edit_sync_options(); + mView->edit_sync_options(); if ( result == 0 ) { //qDebug("Now sycing ... "); if ( ret = mView->syncCalendar( fn, KOPrefs::instance()->mSyncAlgoPrefs ) ) setCaption( i18n("Synchronization successful") ); @@ -1886,9 +1902,9 @@ void MainWindow::confSync() { mView->confSync(); fillSyncMenu(); //mView->writeSettings(); - + } void MainWindow::syncRemote( KSyncProfile* prof, bool ask) { @@ -1896,9 +1912,9 @@ void MainWindow::syncRemote( KSyncProfile* prof, bool ask) if ( ask ) { question = i18n("Do you really want\nto remote sync\nwith profile \n")+ prof->getName()+" ?\n"; if ( QMessageBox::information( this, i18n("KO/Pi Sync"), question, - i18n("Yes"), i18n("No"), + i18n("Yes"), i18n("No"), 0, 0 ) != 0 ) return; } QString command = prof->getPreSyncCommand(); @@ -1906,11 +1922,11 @@ void MainWindow::syncRemote( KSyncProfile* prof, bool ask) if ( (fi = command.find("$PWD$")) > 0 ) { QString pwd = getPassword(); command = command.left( fi )+ pwd + command.mid( fi+5 ); - } + } int maxlen = 30; - if ( QApplication::desktop()->width() > 320 ) + if ( QApplication::desktop()->width() > 320 ) maxlen += 25; setCaption ( i18n( "Copy remote file to local machine..." ) ); int fileSize = 0; int result = system ( command ); @@ -1927,9 +1943,9 @@ void MainWindow::syncRemote( KSyncProfile* prof, bool ask) question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), question, i18n("Okay!")) ; - setCaption ("KO/Pi"); + setCaption ("KO/Pi"); return; } setCaption ( i18n( "Copying succeed." ) ); //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); @@ -1938,9 +1954,9 @@ void MainWindow::syncRemote( KSyncProfile* prof, bool ask) // e->setReadOnly( false ); // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); // e->setReadOnly( true ); if ( KOPrefs::instance()->mWriteBackFile ) { - command = prof->getPostSyncCommand(); + command = prof->getPostSyncCommand(); setCaption ( i18n( "Writing back file ..." ) ); result = system ( command ); qDebug("KO: Writing back file result: %d ", result); if ( result != 0 ) { @@ -1953,11 +1969,11 @@ void MainWindow::syncRemote( KSyncProfile* prof, bool ask) } return; } void MainWindow::syncSSH() -{ +{ // not used anymore - QTime timer; + QTime timer; timer.start(); //qDebug("MainWindow::syncssh() "); KOPrefs *p = KOPrefs::instance(); QString localFile = p->mLocalTempFile; @@ -1970,9 +1986,9 @@ void MainWindow::syncSSH() QString question = i18n("Do you really want\nto remote sync?\n \n") + i18n("IP: " ) +remoteIP +"\n" + i18n("User: " ) + remoteUser +"\n" ; int maxlen = 30; - if ( QApplication::desktop()->width() > 320 ) + if ( QApplication::desktop()->width() > 320 ) maxlen += 25; if ( remoteFile.length() > maxlen ) question += i18n("Remote file:\n..." ) + remoteFile.right(maxlen) +"\n"; else @@ -1980,12 +1996,12 @@ void MainWindow::syncSSH() if ( localFile.length() > maxlen ) question += i18n("Local temp file:\n..." ) + localFile.right(maxlen) +"\n"; else question += i18n("Local temp file:\n " ) + localFile +"\n"; - + if ( QMessageBox::information( this, i18n("KO/Pi Sync"), question, - i18n("Yes"), i18n("No"), + i18n("Yes"), i18n("No"), 0, 0 ) != 0 ) return; // if ( !p->mUsePassWd ) { // QString pass = getPassword(); @@ -2009,9 +2025,9 @@ void MainWindow::syncSSH() question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), question, i18n("Okay!")) ; - setCaption ("KO/Pi"); + setCaption ("KO/Pi"); return; } @@ -2022,9 +2038,9 @@ void MainWindow::syncSSH() // e->setReadOnly( false ); // e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); // e->setReadOnly( true ); if ( KOPrefs::instance()->mWriteBackFile ) { - command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; + command = "scp " + localFile +" " +remoteUser + "@" + remoteIP +":" + remoteFile ; setCaption ( i18n( "Writing back file ..." ) ); result = system ( command ); if ( result != 0 ) { int len = maxlen; @@ -2035,9 +2051,9 @@ void MainWindow::syncSSH() question = i18n("Sorry, the copy back command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (command) ; QMessageBox::information( this, i18n("KO/Pi Sync - ERROR"), question, i18n("Okay!")) ; - setCaption ("KO/Pi"); + setCaption ("KO/Pi"); return; } else { setCaption ( i18n( "Syncronization sucessfully completed" ) ); } @@ -2050,9 +2066,9 @@ void MainWindow::syncSSH() qApp->processEvents(); qDebug("MainWindow::merging) "); mView->syncCalendar( "/home/polo/Applications/korganizer/z_sync.ics", 0 ); - while ( mBlockSaveFlag ) + while ( mBlockSaveFlag ) qApp->processEvents(); save(); system ("scp /home/polo/Applications/korganizer/mycalendar.ics zaurus@192.168.0.65:/home/zaurus/Applications/korganizer/mycalendar.ics"); #endif @@ -2065,17 +2081,17 @@ void MainWindow::syncSharp() if ( mCalendarModifiedFlag ) save(); mView->syncSharp(); slotModifiedChanged( true ); - + } void MainWindow::syncPhone() { if ( mCalendarModifiedFlag ) save(); mView->syncPhone(); slotModifiedChanged( true ); - + } void MainWindow::printSel( ) { |