-rw-r--r-- | korganizer/mainwindow.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 40f2cf4..be69be7 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -4,100 +4,101 @@ | |||
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qpainter.h> | 5 | #include <qpainter.h> |
6 | #include <qwhatsthis.h> | 6 | #include <qwhatsthis.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | #include <qlineedit.h> | 8 | #include <qlineedit.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qapp.h> | 11 | #include <qapp.h> |
12 | #include <qfileinfo.h> | 12 | #include <qfileinfo.h> |
13 | #include <qlabel.h> | 13 | #include <qlabel.h> |
14 | #include <qwmatrix.h> | 14 | #include <qwmatrix.h> |
15 | #include <qtextbrowser.h> | 15 | #include <qtextbrowser.h> |
16 | #include <qtextstream.h> | 16 | #include <qtextstream.h> |
17 | #ifndef DESKTOP_VERSION | 17 | #ifndef DESKTOP_VERSION |
18 | #include <qpe/global.h> | 18 | #include <qpe/global.h> |
19 | #include <qpe/qpemenubar.h> | 19 | #include <qpe/qpemenubar.h> |
20 | #include <qpe/qpetoolbar.h> | 20 | #include <qpe/qpetoolbar.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/qpeapplication.h> | 22 | #include <qpe/qpeapplication.h> |
23 | #include <qtopia/alarmserver.h> | 23 | #include <qtopia/alarmserver.h> |
24 | #include <qtopia/qcopenvelope_qws.h> | 24 | #include <qtopia/qcopenvelope_qws.h> |
25 | #else | 25 | #else |
26 | #include <qmenubar.h> | 26 | #include <qmenubar.h> |
27 | #include <qtoolbar.h> | 27 | #include <qtoolbar.h> |
28 | #include <qapplication.h> | 28 | #include <qapplication.h> |
29 | //#include <resource.h> | 29 | //#include <resource.h> |
30 | 30 | ||
31 | #endif | 31 | #endif |
32 | #include <libkcal/calendarlocal.h> | 32 | #include <libkcal/calendarlocal.h> |
33 | #include <libkcal/todo.h> | 33 | #include <libkcal/todo.h> |
34 | #include <libkdepim/ksyncprofile.h> | 34 | #include <libkdepim/ksyncprofile.h> |
35 | #include <libkdepim/kincidenceformatter.h> | 35 | #include <libkdepim/kincidenceformatter.h> |
36 | 36 | ||
37 | #include "calendarview.h" | 37 | #include "calendarview.h" |
38 | #include "koviewmanager.h" | 38 | #include "koviewmanager.h" |
39 | #include "datenavigator.h" | 39 | #include "datenavigator.h" |
40 | #include "koagendaview.h" | 40 | #include "koagendaview.h" |
41 | #include "koagenda.h" | 41 | #include "koagenda.h" |
42 | #include "kodialogmanager.h" | 42 | #include "kodialogmanager.h" |
43 | #include "kdialogbase.h" | 43 | #include "kdialogbase.h" |
44 | #include "kstandarddirs.h" | 44 | #include "kstandarddirs.h" |
45 | #include "koprefs.h" | 45 | #include "koprefs.h" |
46 | #include "kfiledialog.h" | 46 | #include "kfiledialog.h" |
47 | #include "koglobals.h" | 47 | #include "koglobals.h" |
48 | #include "kglobal.h" | 48 | #include "kglobal.h" |
49 | #include "klocale.h" | 49 | #include "klocale.h" |
50 | #include "kconfig.h" | 50 | #include "kconfig.h" |
51 | #include "simplealarmclient.h" | 51 | #include "simplealarmclient.h" |
52 | |||
53 | using namespace KCal; | 52 | using namespace KCal; |
54 | #ifndef _WIN32_ | 53 | #ifndef _WIN32_ |
55 | #include <unistd.h> | 54 | #include <unistd.h> |
55 | #else | ||
56 | #include "koimportoldialog.h" | ||
56 | #endif | 57 | #endif |
57 | #include "mainwindow.h" | 58 | #include "mainwindow.h" |
58 | 59 | ||
59 | int globalFlagBlockStartup; | 60 | int globalFlagBlockStartup; |
60 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 61 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
61 | QMainWindow( parent, name ) | 62 | QMainWindow( parent, name ) |
62 | { | 63 | { |
63 | 64 | ||
64 | #ifdef DESKTOP_VERSION | 65 | #ifdef DESKTOP_VERSION |
65 | setFont( QFont("Arial"), 14 ); | 66 | setFont( QFont("Arial"), 14 ); |
66 | #endif | 67 | #endif |
67 | 68 | ||
68 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 69 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
69 | QString confFile = locateLocal("config","korganizerrc"); | 70 | QString confFile = locateLocal("config","korganizerrc"); |
70 | QFileInfo finf ( confFile ); | 71 | QFileInfo finf ( confFile ); |
71 | bool showWarning = !finf.exists(); | 72 | bool showWarning = !finf.exists(); |
72 | setIcon(SmallIcon( "ko24" ) ); | 73 | setIcon(SmallIcon( "ko24" ) ); |
73 | mBlockAtStartup = true; | 74 | mBlockAtStartup = true; |
74 | mFlagKeyPressed = false; | 75 | mFlagKeyPressed = false; |
75 | setCaption("KOrganizer/Pi"); | 76 | setCaption("KOrganizer/Pi"); |
76 | KOPrefs *p = KOPrefs::instance(); | 77 | KOPrefs *p = KOPrefs::instance(); |
77 | // if ( QApplication::desktop()->height() > 480 ) { | 78 | // if ( QApplication::desktop()->height() > 480 ) { |
78 | // if ( p->mHourSize == 4 ) | 79 | // if ( p->mHourSize == 4 ) |
79 | // p->mHourSize = 6; | 80 | // p->mHourSize = 6; |
80 | // } | 81 | // } |
81 | if ( p->mHourSize > 18 ) | 82 | if ( p->mHourSize > 18 ) |
82 | p->mHourSize = 18; | 83 | p->mHourSize = 18; |
83 | QMainWindow::ToolBarDock tbd; | 84 | QMainWindow::ToolBarDock tbd; |
84 | if ( p->mToolBarHor ) { | 85 | if ( p->mToolBarHor ) { |
85 | if ( p->mToolBarUp ) | 86 | if ( p->mToolBarUp ) |
86 | tbd = Bottom; | 87 | tbd = Bottom; |
87 | else | 88 | else |
88 | tbd = Top; | 89 | tbd = Top; |
89 | } | 90 | } |
90 | else { | 91 | else { |
91 | if ( p->mToolBarUp ) | 92 | if ( p->mToolBarUp ) |
92 | tbd = Right; | 93 | tbd = Right; |
93 | else | 94 | else |
94 | tbd = Left; | 95 | tbd = Left; |
95 | } | 96 | } |
96 | if ( KOPrefs::instance()->mUseAppColors ) | 97 | if ( KOPrefs::instance()->mUseAppColors ) |
97 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 98 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
98 | globalFlagBlockStartup = 1; | 99 | globalFlagBlockStartup = 1; |
99 | iconToolBar = new QPEToolBar( this ); | 100 | iconToolBar = new QPEToolBar( this ); |
100 | addToolBar (iconToolBar , tbd ); | 101 | addToolBar (iconToolBar , tbd ); |
101 | mBlockSaveFlag = false; | 102 | mBlockSaveFlag = false; |
102 | mCalendarModifiedFlag = false; | 103 | mCalendarModifiedFlag = false; |
103 | 104 | ||
@@ -539,96 +540,104 @@ void MainWindow::initActions() | |||
539 | mView, SLOT( deleteIncidence() ) ); | 540 | mView, SLOT( deleteIncidence() ) ); |
540 | 541 | ||
541 | actionMenu->insertSeparator(); | 542 | actionMenu->insertSeparator(); |
542 | 543 | ||
543 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 544 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
544 | this ); | 545 | this ); |
545 | action->addTo( actionMenu ); | 546 | action->addTo( actionMenu ); |
546 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 547 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
547 | 548 | ||
548 | icon = loadPixmap( pathString + "search" ); | 549 | icon = loadPixmap( pathString + "search" ); |
549 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 550 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
550 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); | 551 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); |
551 | search_action->addTo( actionMenu ); | 552 | search_action->addTo( actionMenu ); |
552 | connect( search_action, SIGNAL( activated() ), | 553 | connect( search_action, SIGNAL( activated() ), |
553 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 554 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
554 | 555 | ||
555 | icon = loadPixmap( pathString + "today" ); | 556 | icon = loadPixmap( pathString + "today" ); |
556 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 557 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
557 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 558 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
558 | today_action->addTo( actionMenu ); | 559 | today_action->addTo( actionMenu ); |
559 | connect( today_action, SIGNAL( activated() ), | 560 | connect( today_action, SIGNAL( activated() ), |
560 | mView, SLOT( goToday() ) ); | 561 | mView, SLOT( goToday() ) ); |
561 | 562 | ||
562 | if ( KOPrefs::instance()->mShowFullMenu ) { | 563 | if ( KOPrefs::instance()->mShowFullMenu ) { |
563 | actionMenu->insertSeparator(); | 564 | actionMenu->insertSeparator(); |
564 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 565 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
565 | 566 | ||
566 | } | 567 | } |
567 | // actionMenu->insertSeparator(); | 568 | // actionMenu->insertSeparator(); |
568 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 569 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
569 | this ); | 570 | this ); |
570 | action->addTo( importMenu ); | 571 | action->addTo( importMenu ); |
571 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 572 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
572 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 573 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
573 | this ); | 574 | this ); |
574 | action->addTo( importMenu ); | 575 | action->addTo( importMenu ); |
575 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 576 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
576 | importMenu->insertSeparator(); | 577 | importMenu->insertSeparator(); |
577 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 578 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
578 | this ); | 579 | this ); |
579 | action->addTo( importMenu ); | 580 | action->addTo( importMenu ); |
580 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 581 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
581 | #ifndef DESKTOP_VERSION | 582 | #ifndef DESKTOP_VERSION |
582 | importMenu->insertSeparator(); | 583 | importMenu->insertSeparator(); |
583 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 584 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
584 | this ); | 585 | this ); |
585 | action->addTo( importMenu ); | 586 | action->addTo( importMenu ); |
586 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 587 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
588 | #else | ||
589 | #ifdef _WIN32_ | ||
590 | importMenu->insertSeparator(); | ||
591 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | ||
592 | this ); | ||
593 | action->addTo( importMenu ); | ||
594 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | ||
595 | #endif | ||
587 | #endif | 596 | #endif |
588 | 597 | ||
589 | importMenu->insertSeparator(); | 598 | importMenu->insertSeparator(); |
590 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 599 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
591 | this ); | 600 | this ); |
592 | action->addTo( importMenu ); | 601 | action->addTo( importMenu ); |
593 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 602 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
594 | 603 | ||
595 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 604 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
596 | this ); | 605 | this ); |
597 | action->addTo( importMenu ); | 606 | action->addTo( importMenu ); |
598 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 607 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
599 | 608 | ||
600 | importMenu->insertSeparator(); | 609 | importMenu->insertSeparator(); |
601 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 610 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
602 | this ); | 611 | this ); |
603 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 612 | action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
604 | importMenu->insertSeparator(); | 613 | importMenu->insertSeparator(); |
605 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 614 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
606 | this ); | 615 | this ); |
607 | action->addTo( importMenu ); | 616 | action->addTo( importMenu ); |
608 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 617 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
609 | #ifndef DESKTOP_VERSION | 618 | #ifndef DESKTOP_VERSION |
610 | importMenu->insertSeparator(); | 619 | importMenu->insertSeparator(); |
611 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 620 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
612 | this ); | 621 | this ); |
613 | action->addTo( importMenu ); | 622 | action->addTo( importMenu ); |
614 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 623 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
615 | 624 | ||
616 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 625 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
617 | this ); | 626 | this ); |
618 | action->addTo( importMenu ); | 627 | action->addTo( importMenu ); |
619 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 628 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
620 | #else | 629 | #else |
621 | importMenu->insertSeparator(); | 630 | importMenu->insertSeparator(); |
622 | icon = loadPixmap( pathString + "print" ); | 631 | icon = loadPixmap( pathString + "print" ); |
623 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 632 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
624 | action->addTo( importMenu ); | 633 | action->addTo( importMenu ); |
625 | connect( action, SIGNAL( activated() ), | 634 | connect( action, SIGNAL( activated() ), |
626 | this, SLOT( printCal() ) ); | 635 | this, SLOT( printCal() ) ); |
627 | 636 | ||
628 | icon = loadPixmap( pathString + "print" ); | 637 | icon = loadPixmap( pathString + "print" ); |
629 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 638 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
630 | action->addTo( importMenu ); | 639 | action->addTo( importMenu ); |
631 | connect( action, SIGNAL( activated() ), | 640 | connect( action, SIGNAL( activated() ), |
632 | this, SLOT( printSel() ) ); | 641 | this, SLOT( printSel() ) ); |
633 | #endif | 642 | #endif |
634 | importMenu->insertSeparator(); | 643 | importMenu->insertSeparator(); |
@@ -885,97 +894,99 @@ int MainWindow::ringSync() | |||
885 | #endif | 894 | #endif |
886 | } | 895 | } |
887 | 896 | ||
888 | } | 897 | } |
889 | 898 | ||
890 | } | 899 | } |
891 | delete temp; | 900 | delete temp; |
892 | return syncedProfiles; | 901 | return syncedProfiles; |
893 | } | 902 | } |
894 | 903 | ||
895 | void MainWindow::multiSync( bool askforPrefs ) | 904 | void MainWindow::multiSync( bool askforPrefs ) |
896 | { | 905 | { |
897 | if (mBlockSaveFlag) | 906 | if (mBlockSaveFlag) |
898 | return; | 907 | return; |
899 | mBlockSaveFlag = true; | 908 | mBlockSaveFlag = true; |
900 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); | 909 | QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); |
901 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), | 910 | if ( QMessageBox::information( this, i18n("KO/Pi Sync"), |
902 | question, | 911 | question, |
903 | i18n("Yes"), i18n("No"), | 912 | i18n("Yes"), i18n("No"), |
904 | 0, 0 ) != 0 ) { | 913 | 0, 0 ) != 0 ) { |
905 | mBlockSaveFlag = false; | 914 | mBlockSaveFlag = false; |
906 | setCaption(i18n("Aborted! Nothing synced!")); | 915 | setCaption(i18n("Aborted! Nothing synced!")); |
907 | return; | 916 | return; |
908 | } | 917 | } |
909 | mView->setSyncDevice(i18n("Multiple profiles") ); | 918 | mView->setSyncDevice(i18n("Multiple profiles") ); |
910 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; | 919 | KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; |
911 | if ( askforPrefs ) { | 920 | if ( askforPrefs ) { |
912 | mView->edit_sync_options(); | 921 | mView->edit_sync_options(); |
913 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; | 922 | KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; |
914 | } | 923 | } |
915 | setCaption(i18n("Multiple sync started.") ); | 924 | setCaption(i18n("Multiple sync started.") ); |
916 | qApp->processEvents(); | 925 | qApp->processEvents(); |
917 | int num = ringSync() ; | 926 | int num = ringSync() ; |
918 | if ( num > 1 ) | 927 | if ( num > 1 ) |
919 | ringSync(); | 928 | ringSync(); |
920 | mBlockSaveFlag = false; | 929 | mBlockSaveFlag = false; |
921 | if ( num ) | 930 | if ( num ) |
922 | save(); | 931 | save(); |
923 | if ( num ) | 932 | if ( num ) |
924 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); | 933 | setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); |
925 | else | 934 | else |
926 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 935 | setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
927 | return; | 936 | return; |
928 | } | 937 | } |
929 | void MainWindow::slotSyncMenu( int action ) | 938 | void MainWindow::slotSyncMenu( int action ) |
930 | { | 939 | { |
931 | //qDebug("syncaction %d ", action); | 940 | //qDebug("syncaction %d ", action); |
932 | if ( action == 0 ) { | 941 | if ( action == 0 ) { |
942 | |||
933 | confSync(); | 943 | confSync(); |
944 | |||
934 | return; | 945 | return; |
935 | } | 946 | } |
936 | if ( action == 1 ) { | 947 | if ( action == 1 ) { |
937 | multiSync( true ); | 948 | multiSync( true ); |
938 | return; | 949 | return; |
939 | } | 950 | } |
940 | 951 | ||
941 | if (mBlockSaveFlag) | 952 | if (mBlockSaveFlag) |
942 | return; | 953 | return; |
943 | mBlockSaveFlag = true; | 954 | mBlockSaveFlag = true; |
944 | mCurrentSyncProfile = action - 1000 ; | 955 | mCurrentSyncProfile = action - 1000 ; |
945 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); | 956 | mView->setSyncDevice(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile] ); |
946 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); | 957 | mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); |
947 | KConfig *config = KOGlobals::config(); | 958 | KConfig *config = KOGlobals::config(); |
948 | KSyncProfile* temp = new KSyncProfile (); | 959 | KSyncProfile* temp = new KSyncProfile (); |
949 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); | 960 | temp->setName(KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); |
950 | temp->readConfig(config); | 961 | temp->readConfig(config); |
951 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); | 962 | KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); |
952 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); | 963 | KOPrefs::instance()->mSyncAlgoPrefs = temp->getSyncPrefs(); |
953 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); | 964 | KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); |
954 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); | 965 | KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); |
955 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); | 966 | KOPrefs::instance()->mShowSyncSummary = temp->getShowSummaryAfterSync(); |
956 | if ( action == 1000 ) { | 967 | if ( action == 1000 ) { |
957 | syncSharp(); | 968 | syncSharp(); |
958 | 969 | ||
959 | } else if ( action == 1001 ) { | 970 | } else if ( action == 1001 ) { |
960 | syncLocalFile(); | 971 | syncLocalFile(); |
961 | 972 | ||
962 | } else if ( action == 1002 ) { | 973 | } else if ( action == 1002 ) { |
963 | quickSyncLocalFile(); | 974 | quickSyncLocalFile(); |
964 | 975 | ||
965 | } else if ( action >= 1003 ) { | 976 | } else if ( action >= 1003 ) { |
966 | if ( temp->getIsLocalFileSync() ) { | 977 | if ( temp->getIsLocalFileSync() ) { |
967 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) | 978 | if ( syncWithFile( temp->getRemoteFileName( ), false ) ) |
968 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); | 979 | KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); |
969 | } else { | 980 | } else { |
970 | syncRemote( temp ); | 981 | syncRemote( temp ); |
971 | 982 | ||
972 | } | 983 | } |
973 | } | 984 | } |
974 | delete temp; | 985 | delete temp; |
975 | mBlockSaveFlag = false; | 986 | mBlockSaveFlag = false; |
976 | } | 987 | } |
977 | void MainWindow::setDefaultPreferences() | 988 | void MainWindow::setDefaultPreferences() |
978 | { | 989 | { |
979 | KOPrefs *p = KOPrefs::instance(); | 990 | KOPrefs *p = KOPrefs::instance(); |
980 | 991 | ||
981 | p->mCompactDialogs = true; | 992 | p->mCompactDialogs = true; |
@@ -1174,96 +1185,105 @@ void MainWindow::processIncidenceSelection( Incidence *incidence ) | |||
1174 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1185 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1175 | 1186 | ||
1176 | } | 1187 | } |
1177 | 1188 | ||
1178 | } else { | 1189 | } else { |
1179 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1190 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1180 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1191 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1181 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1192 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1182 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1193 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1183 | } | 1194 | } |
1184 | 1195 | ||
1185 | } | 1196 | } |
1186 | else | 1197 | else |
1187 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1198 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1188 | if ( !incidence->location().isEmpty() ) | 1199 | if ( !incidence->location().isEmpty() ) |
1189 | startString += " (" +incidence->location()+")"; | 1200 | startString += " (" +incidence->location()+")"; |
1190 | setCaption( incidence->summary()+startString); | 1201 | setCaption( incidence->summary()+startString); |
1191 | 1202 | ||
1192 | enableIncidenceActions( true ); | 1203 | enableIncidenceActions( true ); |
1193 | 1204 | ||
1194 | if ( incidence->type() == "Event" ) { | 1205 | if ( incidence->type() == "Event" ) { |
1195 | mShowAction->setText( i18n("Show Event...") ); | 1206 | mShowAction->setText( i18n("Show Event...") ); |
1196 | mEditAction->setText( i18n("Edit Event...") ); | 1207 | mEditAction->setText( i18n("Edit Event...") ); |
1197 | mDeleteAction->setText( i18n("Delete Event...") ); | 1208 | mDeleteAction->setText( i18n("Delete Event...") ); |
1198 | 1209 | ||
1199 | mNewSubTodoAction->setEnabled( false ); | 1210 | mNewSubTodoAction->setEnabled( false ); |
1200 | } else if ( incidence->type() == "Todo" ) { | 1211 | } else if ( incidence->type() == "Todo" ) { |
1201 | mShowAction->setText( i18n("Show Todo...") ); | 1212 | mShowAction->setText( i18n("Show Todo...") ); |
1202 | mEditAction->setText( i18n("Edit Todo...") ); | 1213 | mEditAction->setText( i18n("Edit Todo...") ); |
1203 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1214 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1204 | 1215 | ||
1205 | mNewSubTodoAction->setEnabled( true ); | 1216 | mNewSubTodoAction->setEnabled( true ); |
1206 | } else { | 1217 | } else { |
1207 | mShowAction->setText( i18n("Show...") ); | 1218 | mShowAction->setText( i18n("Show...") ); |
1208 | mShowAction->setText( i18n("Edit...") ); | 1219 | mShowAction->setText( i18n("Edit...") ); |
1209 | mShowAction->setText( i18n("Delete...") ); | 1220 | mShowAction->setText( i18n("Delete...") ); |
1210 | 1221 | ||
1211 | mNewSubTodoAction->setEnabled( false ); | 1222 | mNewSubTodoAction->setEnabled( false ); |
1212 | } | 1223 | } |
1213 | } | 1224 | } |
1214 | 1225 | ||
1215 | void MainWindow::enableIncidenceActions( bool enabled ) | 1226 | void MainWindow::enableIncidenceActions( bool enabled ) |
1216 | { | 1227 | { |
1217 | mShowAction->setEnabled( enabled ); | 1228 | mShowAction->setEnabled( enabled ); |
1218 | mEditAction->setEnabled( enabled ); | 1229 | mEditAction->setEnabled( enabled ); |
1219 | mDeleteAction->setEnabled( enabled ); | 1230 | mDeleteAction->setEnabled( enabled ); |
1220 | } | 1231 | } |
1221 | 1232 | ||
1233 | void MainWindow::importOL() | ||
1234 | { | ||
1235 | #ifdef _WIN32_ | ||
1236 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | ||
1237 | id->exec(); | ||
1238 | delete id; | ||
1239 | mView->updateView(); | ||
1240 | #endif | ||
1241 | } | ||
1222 | void MainWindow::importBday() | 1242 | void MainWindow::importBday() |
1223 | { | 1243 | { |
1224 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1244 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1225 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1245 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1226 | i18n("Import!"), i18n("Cancel"), 0, | 1246 | i18n("Import!"), i18n("Cancel"), 0, |
1227 | 0, 1 ); | 1247 | 0, 1 ); |
1228 | if ( result == 0 ) { | 1248 | if ( result == 0 ) { |
1229 | mView->importBday(); | 1249 | mView->importBday(); |
1230 | 1250 | ||
1231 | } | 1251 | } |
1232 | 1252 | ||
1233 | 1253 | ||
1234 | } | 1254 | } |
1235 | void MainWindow::importQtopia() | 1255 | void MainWindow::importQtopia() |
1236 | { | 1256 | { |
1237 | #ifndef DESKTOP_VERSION | 1257 | #ifndef DESKTOP_VERSION |
1238 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1258 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1239 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), | 1259 | i18n("When importing a calendar twice\nduplicated events will be ignored!\nYou can create a backup file with\nFile - Save Calendar Backup\nto revert importing"), |
1240 | i18n("Import!"), i18n("Cancel"), 0, | 1260 | i18n("Import!"), i18n("Cancel"), 0, |
1241 | 0, 1 ); | 1261 | 0, 1 ); |
1242 | if ( result == 0 ) { | 1262 | if ( result == 0 ) { |
1243 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1263 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1244 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1264 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1245 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1265 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1246 | mView->importQtopia( categories, datebook, todolist ); | 1266 | mView->importQtopia( categories, datebook, todolist ); |
1247 | } | 1267 | } |
1248 | #else | 1268 | #else |
1249 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1269 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1250 | i18n("Not supported \non desktop!\n"), | 1270 | i18n("Not supported \non desktop!\n"), |
1251 | i18n("Ok"), i18n("Cancel"), 0, | 1271 | i18n("Ok"), i18n("Cancel"), 0, |
1252 | 0, 1 ); | 1272 | 0, 1 ); |
1253 | 1273 | ||
1254 | #endif | 1274 | #endif |
1255 | } | 1275 | } |
1256 | 1276 | ||
1257 | void MainWindow::saveOnClose() | 1277 | void MainWindow::saveOnClose() |
1258 | { | 1278 | { |
1259 | KOPrefs *p = KOPrefs::instance(); | 1279 | KOPrefs *p = KOPrefs::instance(); |
1260 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1280 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1261 | p->mToolBarUp = iconToolBar->x() > width()/2 || | 1281 | p->mToolBarUp = iconToolBar->x() > width()/2 || |
1262 | iconToolBar->y() > height()/2; | 1282 | iconToolBar->y() > height()/2; |
1263 | mView->writeSettings(); | 1283 | mView->writeSettings(); |
1264 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1284 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1265 | save(); | 1285 | save(); |
1266 | } | 1286 | } |
1267 | void MainWindow::slotModifiedChanged( bool changed ) | 1287 | void MainWindow::slotModifiedChanged( bool changed ) |
1268 | { | 1288 | { |
1269 | if ( mBlockAtStartup ) | 1289 | if ( mBlockAtStartup ) |