-rw-r--r-- | desktop/rpm/kdepim_rpm | 2 | ||||
-rw-r--r-- | korganizer/mainwindow.cpp | 4 | ||||
-rw-r--r-- | microkde/ofontselector.cpp | 3 | ||||
-rw-r--r-- | version | 2 |
4 files changed, 6 insertions, 5 deletions
diff --git a/desktop/rpm/kdepim_rpm b/desktop/rpm/kdepim_rpm index 5e7783b..af64b99 100644 --- a/desktop/rpm/kdepim_rpm +++ b/desktop/rpm/kdepim_rpm | |||
@@ -1,84 +1,84 @@ | |||
1 | Summary: A collection of PIM programs | 1 | Summary: A collection of PIM programs |
2 | Name: KDE-Pim-Pi | 2 | Name: KDE-Pim-Pi |
3 | Version: 2.0.24 | 3 | Version: 2.0.25 |
4 | Release: SuSE_9.2 | 4 | Release: SuSE_9.2 |
5 | Copyright:GPL | 5 | Copyright:GPL |
6 | Group: Productivity/Pim | 6 | Group: Productivity/Pim |
7 | Source:http://sourceforge.net/projects/kdepimpi/ | 7 | Source:http://sourceforge.net/projects/kdepimpi/ |
8 | URL:http://sourceforge.net/projects/kdepimpi/ | 8 | URL:http://sourceforge.net/projects/kdepimpi/ |
9 | Packager: zautrix | 9 | Packager: zautrix |
10 | 10 | ||
11 | %description | 11 | %description |
12 | This package contains the platform-independent PIM programs from | 12 | This package contains the platform-independent PIM programs from |
13 | www.pi-sync.info, compiled for SuSE 9.2: | 13 | www.pi-sync.info, compiled for SuSE 9.2: |
14 | KTimeTacker/Pi | 14 | KTimeTacker/Pi |
15 | KPhone/Pi | 15 | KPhone/Pi |
16 | KAddressbook/Pi | 16 | KAddressbook/Pi |
17 | KOrganizer/Pi | 17 | KOrganizer/Pi |
18 | PasswordManager/Pi | 18 | PasswordManager/Pi |
19 | KOPieMail/Pi | 19 | KOPieMail/Pi |
20 | 20 | ||
21 | These applications do not need anything from the KDE-desktop | 21 | These applications do not need anything from the KDE-desktop |
22 | at all to run on Linux. However, there is a dependency from | 22 | at all to run on Linux. However, there is a dependency from |
23 | two KDE libs, because a small command line program is included | 23 | two KDE libs, because a small command line program is included |
24 | to make it possible to sync with the KDE-desktop applications. | 24 | to make it possible to sync with the KDE-desktop applications. |
25 | 25 | ||
26 | These applications are independent from the KDE-desktop | 26 | These applications are independent from the KDE-desktop |
27 | environment. That means, nothing of your existing | 27 | environment. That means, nothing of your existing |
28 | KDE-desktop setup will be changed, or any data | 28 | KDE-desktop setup will be changed, or any data |
29 | (calendar-addressbook) used by the KDE-desktop | 29 | (calendar-addressbook) used by the KDE-desktop |
30 | applications will be changed or accessed. | 30 | applications will be changed or accessed. |
31 | These applications stores their data and config in | 31 | These applications stores their data and config in |
32 | $HOME/kdepim/ | 32 | $HOME/kdepim/ |
33 | However, because the same file format is used, | 33 | However, because the same file format is used, |
34 | an easy exchange of data with the KDE-desktop | 34 | an easy exchange of data with the KDE-desktop |
35 | is possible. | 35 | is possible. |
36 | A small command line program is included | 36 | A small command line program is included |
37 | to make it possible to sync with the KDE-desktop applications. | 37 | to make it possible to sync with the KDE-desktop applications. |
38 | You do not need to call this program from the commandline, | 38 | You do not need to call this program from the commandline, |
39 | it is called from the KDE-Pim/Pi apps when you choose there: | 39 | it is called from the KDE-Pim/Pi apps when you choose there: |
40 | Sync with KDE_Desktop. | 40 | Sync with KDE_Desktop. |
41 | If something is going wrong, please start the | 41 | If something is going wrong, please start the |
42 | KDE-Pim/Pi program itself from the console to get detailed output. | 42 | KDE-Pim/Pi program itself from the console to get detailed output. |
43 | 43 | ||
44 | After installation, you should have a | 44 | After installation, you should have a |
45 | PIM-pi | 45 | PIM-pi |
46 | folder in your KDE start menu, where you can | 46 | folder in your KDE start menu, where you can |
47 | start the applications from. | 47 | start the applications from. |
48 | 48 | ||
49 | These programs makes it possible to sync your Zaurus easily | 49 | These programs makes it possible to sync your Zaurus easily |
50 | (with the KDE-Pim/Pi programs running on the Zaurus) | 50 | (with the KDE-Pim/Pi programs running on the Zaurus) |
51 | with the KDE-desktop calendar/addressbook data. | 51 | with the KDE-desktop calendar/addressbook data. |
52 | If you want to use that, you have to update your | 52 | If you want to use that, you have to update your |
53 | KDE-desktop to version 3.3.0 or higher. | 53 | KDE-desktop to version 3.3.0 or higher. |
54 | SuSE 9.2 contains KDE 3.3.0 such that no update is needed. | 54 | SuSE 9.2 contains KDE 3.3.0 such that no update is needed. |
55 | Actually - after the (non difficult) configuration is set up - | 55 | Actually - after the (non difficult) configuration is set up - |
56 | with two mouseklicks on the Zaurus, | 56 | with two mouseklicks on the Zaurus, |
57 | the Zaurus syncs with the corresponding KDE-Pim/Pi | 57 | the Zaurus syncs with the corresponding KDE-Pim/Pi |
58 | program on the Linux Desktop which syncs automatically | 58 | program on the Linux Desktop which syncs automatically |
59 | with the KDE-desktop data. | 59 | with the KDE-desktop data. |
60 | 60 | ||
61 | If you want to use the KDE-desktop calendar/addressbook applications, | 61 | If you want to use the KDE-desktop calendar/addressbook applications, |
62 | just install these apps in this package and use them as a syncing tool for the | 62 | just install these apps in this package and use them as a syncing tool for the |
63 | Zaurus <-> KDE-desktop sync. | 63 | Zaurus <-> KDE-desktop sync. |
64 | The sync requires a network connection from your Zaurus to | 64 | The sync requires a network connection from your Zaurus to |
65 | the PC. A detailed Sync HowTo is available in the | 65 | the PC. A detailed Sync HowTo is available in the |
66 | Help menu of the applications. | 66 | Help menu of the applications. |
67 | 67 | ||
68 | These applications makes it also possible, that you can sync | 68 | These applications makes it also possible, that you can sync |
69 | (or just export the data to) your mobile phone with your | 69 | (or just export the data to) your mobile phone with your |
70 | data of the KDE-desktop calendar/addressbook applications. | 70 | data of the KDE-desktop calendar/addressbook applications. |
71 | This is tested and working for Nokia mobile phones, | 71 | This is tested and working for Nokia mobile phones, |
72 | it may work with others as well. | 72 | it may work with others as well. |
73 | (More info about that: -> Sync HowTo) | 73 | (More info about that: -> Sync HowTo) |
74 | 74 | ||
75 | NOTE: | 75 | NOTE: |
76 | When using SuSE 9.1 you have to update your KDE to 3.3.x | 76 | When using SuSE 9.1 you have to update your KDE to 3.3.x |
77 | and you have to make an online update in SuSE 9.1 to make it | 77 | and you have to make an online update in SuSE 9.1 to make it |
78 | possible to get the infrared connection working, such that | 78 | possible to get the infrared connection working, such that |
79 | you can sync your (Nokia) mobile phone via infrared. | 79 | you can sync your (Nokia) mobile phone via infrared. |
80 | 80 | ||
81 | %files | 81 | %files |
82 | /opt/kde3/share/applnk/PIM-pi/ | 82 | /opt/kde3/share/applnk/PIM-pi/ |
83 | /opt/kdepimpi/ | 83 | /opt/kdepimpi/ |
84 | /usr/lib/libmicro* | 84 | /usr/lib/libmicro* |
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp index 7aa3b60..9505d06 100644 --- a/korganizer/mainwindow.cpp +++ b/korganizer/mainwindow.cpp | |||
@@ -1,2447 +1,2447 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
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 <qpushbutton.h> | 7 | #include <qpushbutton.h> |
8 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
9 | #include <qlineedit.h> | 9 | #include <qlineedit.h> |
10 | #include <qtextcodec.h> | 10 | #include <qtextcodec.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | #include <qdir.h> | 12 | #include <qdir.h> |
13 | #include <qapp.h> | 13 | #include <qapp.h> |
14 | #include <qfileinfo.h> | 14 | #include <qfileinfo.h> |
15 | #include <qlabel.h> | 15 | #include <qlabel.h> |
16 | #include <qspinbox.h> | 16 | #include <qspinbox.h> |
17 | #include <qcheckbox.h> | 17 | #include <qcheckbox.h> |
18 | #include <qmap.h> | 18 | #include <qmap.h> |
19 | #include <qwmatrix.h> | 19 | #include <qwmatrix.h> |
20 | #include <qtextbrowser.h> | 20 | #include <qtextbrowser.h> |
21 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
22 | #ifndef DESKTOP_VERSION | 22 | #ifndef DESKTOP_VERSION |
23 | #include <qpe/global.h> | 23 | #include <qpe/global.h> |
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qtopia/alarmserver.h> | 28 | #include <qtopia/alarmserver.h> |
29 | #include <qtopia/qcopenvelope_qws.h> | 29 | #include <qtopia/qcopenvelope_qws.h> |
30 | #include <unistd.h> // for sleep | 30 | #include <unistd.h> // for sleep |
31 | #else | 31 | #else |
32 | #include <qmenubar.h> | 32 | #include <qmenubar.h> |
33 | #include <qtoolbar.h> | 33 | #include <qtoolbar.h> |
34 | #include <qapplication.h> | 34 | #include <qapplication.h> |
35 | //#include <resource.h> | 35 | //#include <resource.h> |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | #include <libkcal/calendarlocal.h> | 38 | #include <libkcal/calendarlocal.h> |
39 | #include <libkcal/todo.h> | 39 | #include <libkcal/todo.h> |
40 | #include <libkcal/phoneformat.h> | 40 | #include <libkcal/phoneformat.h> |
41 | #include <libkdepim/ksyncprofile.h> | 41 | #include <libkdepim/ksyncprofile.h> |
42 | #include <libkdepim/phoneaccess.h> | 42 | #include <libkdepim/phoneaccess.h> |
43 | #include <libkcal/kincidenceformatter.h> | 43 | #include <libkcal/kincidenceformatter.h> |
44 | #include <libkdepim/kpimglobalprefs.h> | 44 | #include <libkdepim/kpimglobalprefs.h> |
45 | 45 | ||
46 | #include "calendarview.h" | 46 | #include "calendarview.h" |
47 | #include "koviewmanager.h" | 47 | #include "koviewmanager.h" |
48 | #include "datenavigator.h" | 48 | #include "datenavigator.h" |
49 | #include "koagendaview.h" | 49 | #include "koagendaview.h" |
50 | #include "koagenda.h" | 50 | #include "koagenda.h" |
51 | #include "kodialogmanager.h" | 51 | #include "kodialogmanager.h" |
52 | #include "kdialogbase.h" | 52 | #include "kdialogbase.h" |
53 | #include "kapplication.h" | 53 | #include "kapplication.h" |
54 | #include "kofilterview.h" | 54 | #include "kofilterview.h" |
55 | #include "kstandarddirs.h" | 55 | #include "kstandarddirs.h" |
56 | #include "koprefs.h" | 56 | #include "koprefs.h" |
57 | #include "kfiledialog.h" | 57 | #include "kfiledialog.h" |
58 | #include "koglobals.h" | 58 | #include "koglobals.h" |
59 | #include "kglobal.h" | 59 | #include "kglobal.h" |
60 | #include "ktoolbar.h" | 60 | #include "ktoolbar.h" |
61 | #include "klocale.h" | 61 | #include "klocale.h" |
62 | #include "kconfig.h" | 62 | #include "kconfig.h" |
63 | #include "simplealarmclient.h" | 63 | #include "simplealarmclient.h" |
64 | #include "externalapphandler.h" | 64 | #include "externalapphandler.h" |
65 | 65 | ||
66 | using namespace KCal; | 66 | using namespace KCal; |
67 | #ifndef _WIN32_ | 67 | #ifndef _WIN32_ |
68 | #include <unistd.h> | 68 | #include <unistd.h> |
69 | #else | 69 | #else |
70 | #ifdef _OL_IMPORT_ | 70 | #ifdef _OL_IMPORT_ |
71 | #include "koimportoldialog.h" | 71 | #include "koimportoldialog.h" |
72 | #endif | 72 | #endif |
73 | #endif | 73 | #endif |
74 | #include "mainwindow.h" | 74 | #include "mainwindow.h" |
75 | 75 | ||
76 | 76 | ||
77 | class KOex2phonePrefs : public QDialog | 77 | class KOex2phonePrefs : public QDialog |
78 | { | 78 | { |
79 | public: | 79 | public: |
80 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : | 80 | KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : |
81 | QDialog( parent, name, true ) | 81 | QDialog( parent, name, true ) |
82 | { | 82 | { |
83 | setCaption( i18n("Export to phone options") ); | 83 | setCaption( i18n("Export to phone options") ); |
84 | QVBoxLayout* lay = new QVBoxLayout( this ); | 84 | QVBoxLayout* lay = new QVBoxLayout( this ); |
85 | lay->setSpacing( 3 ); | 85 | lay->setSpacing( 3 ); |
86 | lay->setMargin( 3 ); | 86 | lay->setMargin( 3 ); |
87 | QLabel *lab; | 87 | QLabel *lab; |
88 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); | 88 | lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); |
89 | lab->setAlignment (AlignHCenter ); | 89 | lab->setAlignment (AlignHCenter ); |
90 | QHBox* temphb; | 90 | QHBox* temphb; |
91 | temphb = new QHBox( this ); | 91 | temphb = new QHBox( this ); |
92 | new QLabel( i18n("I/O device: "), temphb ); | 92 | new QLabel( i18n("I/O device: "), temphb ); |
93 | mPhoneDevice = new QLineEdit( temphb); | 93 | mPhoneDevice = new QLineEdit( temphb); |
94 | lay->addWidget( temphb ); | 94 | lay->addWidget( temphb ); |
95 | temphb = new QHBox( this ); | 95 | temphb = new QHBox( this ); |
96 | new QLabel( i18n("Connection: "), temphb ); | 96 | new QLabel( i18n("Connection: "), temphb ); |
97 | mPhoneConnection = new QLineEdit( temphb); | 97 | mPhoneConnection = new QLineEdit( temphb); |
98 | lay->addWidget( temphb ); | 98 | lay->addWidget( temphb ); |
99 | temphb = new QHBox( this ); | 99 | temphb = new QHBox( this ); |
100 | new QLabel( i18n("Model(opt.): "), temphb ); | 100 | new QLabel( i18n("Model(opt.): "), temphb ); |
101 | mPhoneModel = new QLineEdit( temphb); | 101 | mPhoneModel = new QLineEdit( temphb); |
102 | lay->addWidget( temphb ); | 102 | lay->addWidget( temphb ); |
103 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); | 103 | mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); |
104 | mWriteBackFuture->setChecked( true ); | 104 | mWriteBackFuture->setChecked( true ); |
105 | lay->addWidget( mWriteBackFuture ); | 105 | lay->addWidget( mWriteBackFuture ); |
106 | temphb = new QHBox( this ); | 106 | temphb = new QHBox( this ); |
107 | new QLabel( i18n("Max. weeks in future: ") , temphb ); | 107 | new QLabel( i18n("Max. weeks in future: ") , temphb ); |
108 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); | 108 | mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); |
109 | mWriteBackFutureWeeks->setValue( 8 ); | 109 | mWriteBackFutureWeeks->setValue( 8 ); |
110 | lay->addWidget( temphb ); | 110 | lay->addWidget( temphb ); |
111 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); | 111 | lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); |
112 | lab->setAlignment (AlignHCenter ); | 112 | lab->setAlignment (AlignHCenter ); |
113 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); | 113 | QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); |
114 | lay->addWidget( ok ); | 114 | lay->addWidget( ok ); |
115 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); | 115 | QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); |
116 | lay->addWidget( cancel ); | 116 | lay->addWidget( cancel ); |
117 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 117 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
118 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 118 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
119 | resize( 220, 240 ); | 119 | resize( 220, 240 ); |
120 | qApp->processEvents(); | 120 | qApp->processEvents(); |
121 | int dw = QApplication::desktop()->width(); | 121 | int dw = QApplication::desktop()->width(); |
122 | int dh = QApplication::desktop()->height(); | 122 | int dh = QApplication::desktop()->height(); |
123 | move( (dw-width())/2, (dh - height() )/2 ); | 123 | move( (dw-width())/2, (dh - height() )/2 ); |
124 | } | 124 | } |
125 | 125 | ||
126 | public: | 126 | public: |
127 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; | 127 | QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; |
128 | QCheckBox* mWriteBackFuture; | 128 | QCheckBox* mWriteBackFuture; |
129 | QSpinBox* mWriteBackFutureWeeks; | 129 | QSpinBox* mWriteBackFutureWeeks; |
130 | }; | 130 | }; |
131 | 131 | ||
132 | int globalFlagBlockStartup; | 132 | int globalFlagBlockStartup; |
133 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : | 133 | MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : |
134 | QMainWindow( parent, name ) | 134 | QMainWindow( parent, name ) |
135 | { | 135 | { |
136 | 136 | ||
137 | mClosed = false; | 137 | mClosed = false; |
138 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; | 138 | //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; |
139 | QString confFile = locateLocal("config","korganizerrc"); | 139 | QString confFile = locateLocal("config","korganizerrc"); |
140 | QFileInfo finf ( confFile ); | 140 | QFileInfo finf ( confFile ); |
141 | bool showWarning = !finf.exists(); | 141 | bool showWarning = !finf.exists(); |
142 | setIcon(SmallIcon( "ko24" ) ); | 142 | setIcon(SmallIcon( "ko24" ) ); |
143 | mBlockAtStartup = true; | 143 | mBlockAtStartup = true; |
144 | mFlagKeyPressed = false; | 144 | mFlagKeyPressed = false; |
145 | setCaption("KO/Pi"); | 145 | setCaption("KO/Pi"); |
146 | KOPrefs *p = KOPrefs::instance(); | 146 | KOPrefs *p = KOPrefs::instance(); |
147 | KPimGlobalPrefs::instance()->setGlobalConfig(); | 147 | KPimGlobalPrefs::instance()->setGlobalConfig(); |
148 | p->mCurrentDisplayedView = 0; | 148 | p->mCurrentDisplayedView = 0; |
149 | if ( p->mHourSize > 22 ) | 149 | if ( p->mHourSize > 22 ) |
150 | p->mHourSize = 22; | 150 | p->mHourSize = 22; |
151 | QMainWindow::ToolBarDock tbd; | 151 | QMainWindow::ToolBarDock tbd; |
152 | if ( p->mToolBarHor ) { | 152 | if ( p->mToolBarHor ) { |
153 | if ( p->mToolBarUp ) | 153 | if ( p->mToolBarUp ) |
154 | tbd = Bottom; | 154 | tbd = Bottom; |
155 | else | 155 | else |
156 | tbd = Top; | 156 | tbd = Top; |
157 | } | 157 | } |
158 | else { | 158 | else { |
159 | if ( p->mToolBarUp ) | 159 | if ( p->mToolBarUp ) |
160 | tbd = Right; | 160 | tbd = Right; |
161 | else | 161 | else |
162 | tbd = Left; | 162 | tbd = Left; |
163 | } | 163 | } |
164 | if ( KOPrefs::instance()->mUseAppColors ) | 164 | if ( KOPrefs::instance()->mUseAppColors ) |
165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); | 165 | QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); |
166 | globalFlagBlockStartup = 1; | 166 | globalFlagBlockStartup = 1; |
167 | iconToolBar = new QPEToolBar( this ); | 167 | iconToolBar = new QPEToolBar( this ); |
168 | addToolBar (iconToolBar , tbd ); | 168 | addToolBar (iconToolBar , tbd ); |
169 | 169 | ||
170 | #ifdef DESKTOP_VERSION | 170 | #ifdef DESKTOP_VERSION |
171 | if ( KOPrefs::instance()->mShowIconFilter ) | 171 | if ( KOPrefs::instance()->mShowIconFilter ) |
172 | #else | 172 | #else |
173 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) | 173 | if ( KOPrefs::instance()->mShowIconFilter || !p->mShowIconOnetoolbar ) |
174 | #endif | 174 | #endif |
175 | 175 | ||
176 | { | 176 | { |
177 | if ( p->mToolBarHorF ) { | 177 | if ( p->mToolBarHorF ) { |
178 | if ( p->mToolBarUpF ) | 178 | if ( p->mToolBarUpF ) |
179 | tbd = Bottom; | 179 | tbd = Bottom; |
180 | else | 180 | else |
181 | tbd = Top; | 181 | tbd = Top; |
182 | } | 182 | } |
183 | else { | 183 | else { |
184 | if ( p->mToolBarUpF ) | 184 | if ( p->mToolBarUpF ) |
185 | tbd = Right; | 185 | tbd = Right; |
186 | else | 186 | else |
187 | tbd = Left; | 187 | tbd = Left; |
188 | } | 188 | } |
189 | filterToolBar = new QPEToolBar ( this ); | 189 | filterToolBar = new QPEToolBar ( this ); |
190 | filterMenubar = new QPEMenuBar( filterToolBar ); | 190 | filterMenubar = new QPEMenuBar( filterToolBar ); |
191 | QFontMetrics fm ( filterMenubar->font() ); | 191 | QFontMetrics fm ( filterMenubar->font() ); |
192 | 192 | ||
193 | filterPopupMenu = new QPopupMenu( this ); | 193 | filterPopupMenu = new QPopupMenu( this ); |
194 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); | 194 | filterMenubar->insertItem( i18n("No Filter"), filterPopupMenu,0 ); |
195 | QString addTest = "Ax"; | 195 | QString addTest = "Ax"; |
196 | #ifdef DESKTOP_VERSION | 196 | #ifdef DESKTOP_VERSION |
197 | addTest = "AAAx"; | 197 | addTest = "AAAx"; |
198 | #endif | 198 | #endif |
199 | filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) ); | 199 | filterMenubar->setFixedWidth( fm.width( i18n("No Filter")+addTest ) ); |
200 | addToolBar (filterToolBar , tbd ); | 200 | addToolBar (filterToolBar , tbd ); |
201 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); | 201 | connect ( filterPopupMenu , SIGNAL( activated ( int ) ), this, SLOT (selectFilterPopup( int ) ) ); |
202 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); | 202 | connect ( filterPopupMenu , SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenuPopup() ) ); |
203 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) | 203 | if ( !KOPrefs::instance()->mShowIconFilter && !p->mShowIconOnetoolbar ) |
204 | filterToolBar->hide(); | 204 | filterToolBar->hide(); |
205 | } else { | 205 | } else { |
206 | filterToolBar = 0; | 206 | filterToolBar = 0; |
207 | filterMenubar = 0; | 207 | filterMenubar = 0; |
208 | filterPopupMenu = 0; | 208 | filterPopupMenu = 0; |
209 | } | 209 | } |
210 | if ( p->mShowIconOnetoolbar ) { | 210 | if ( p->mShowIconOnetoolbar ) { |
211 | viewToolBar = iconToolBar ; | 211 | viewToolBar = iconToolBar ; |
212 | navigatorToolBar = iconToolBar ; | 212 | navigatorToolBar = iconToolBar ; |
213 | } else { | 213 | } else { |
214 | #ifndef DESKTOP_VERSION | 214 | #ifndef DESKTOP_VERSION |
215 | setToolBarsMovable( false ); | 215 | setToolBarsMovable( false ); |
216 | #endif | 216 | #endif |
217 | if ( p->mToolBarHorV ) { | 217 | if ( p->mToolBarHorV ) { |
218 | if ( p->mToolBarUpV ) | 218 | if ( p->mToolBarUpV ) |
219 | tbd = Bottom; | 219 | tbd = Bottom; |
220 | else | 220 | else |
221 | tbd = Top; | 221 | tbd = Top; |
222 | } | 222 | } |
223 | else { | 223 | else { |
224 | if ( p->mToolBarUpV ) | 224 | if ( p->mToolBarUpV ) |
225 | tbd = Right; | 225 | tbd = Right; |
226 | else | 226 | else |
227 | tbd = Left; | 227 | tbd = Left; |
228 | } | 228 | } |
229 | viewToolBar = new QPEToolBar( this ); | 229 | viewToolBar = new QPEToolBar( this ); |
230 | addToolBar (viewToolBar , tbd ); | 230 | addToolBar (viewToolBar , tbd ); |
231 | if ( p->mToolBarHorN ) { | 231 | if ( p->mToolBarHorN ) { |
232 | if ( p->mToolBarUpN ) | 232 | if ( p->mToolBarUpN ) |
233 | tbd = Bottom; | 233 | tbd = Bottom; |
234 | else | 234 | else |
235 | tbd = Top; | 235 | tbd = Top; |
236 | } | 236 | } |
237 | else { | 237 | else { |
238 | if ( p->mToolBarUpN ) | 238 | if ( p->mToolBarUpN ) |
239 | tbd = Right; | 239 | tbd = Right; |
240 | else | 240 | else |
241 | tbd = Left; | 241 | tbd = Left; |
242 | } | 242 | } |
243 | navigatorToolBar = new QPEToolBar( this ); | 243 | navigatorToolBar = new QPEToolBar( this ); |
244 | addToolBar (navigatorToolBar , tbd ); | 244 | addToolBar (navigatorToolBar , tbd ); |
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
248 | 248 | ||
249 | mCalendarModifiedFlag = false; | 249 | mCalendarModifiedFlag = false; |
250 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); | 250 | QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); |
251 | splash->setAlignment ( AlignCenter ); | 251 | splash->setAlignment ( AlignCenter ); |
252 | setCentralWidget( splash ); | 252 | setCentralWidget( splash ); |
253 | #ifndef DESKTOP_VERSION | 253 | #ifndef DESKTOP_VERSION |
254 | showMaximized(); | 254 | showMaximized(); |
255 | #endif | 255 | #endif |
256 | 256 | ||
257 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); | 257 | //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); |
258 | setDefaultPreferences(); | 258 | setDefaultPreferences(); |
259 | mCalendar = new CalendarLocal(); | 259 | mCalendar = new CalendarLocal(); |
260 | mView = new CalendarView( mCalendar, this,"mCalendar " ); | 260 | mView = new CalendarView( mCalendar, this,"mCalendar " ); |
261 | mView->hide(); | 261 | mView->hide(); |
262 | //mView->resize(splash->size() ); | 262 | //mView->resize(splash->size() ); |
263 | initActions(); | 263 | initActions(); |
264 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); | 264 | mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); |
265 | mSyncManager->setBlockSave(false); | 265 | mSyncManager->setBlockSave(false); |
266 | mView->setSyncManager(mSyncManager); | 266 | mView->setSyncManager(mSyncManager); |
267 | #ifndef DESKTOP_VERSION | 267 | #ifndef DESKTOP_VERSION |
268 | iconToolBar->show(); | 268 | iconToolBar->show(); |
269 | qApp->processEvents(); | 269 | qApp->processEvents(); |
270 | #endif | 270 | #endif |
271 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); | 271 | //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); |
272 | int vh = height() ; | 272 | int vh = height() ; |
273 | int vw = width(); | 273 | int vw = width(); |
274 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); | 274 | //qDebug("Toolbar hei %d ",iconToolBar->height() ); |
275 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 275 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
276 | vh -= iconToolBar->height(); | 276 | vh -= iconToolBar->height(); |
277 | } else { | 277 | } else { |
278 | vw -= iconToolBar->height(); | 278 | vw -= iconToolBar->height(); |
279 | } | 279 | } |
280 | //mView->setMaximumSize( splash->size() ); | 280 | //mView->setMaximumSize( splash->size() ); |
281 | //mView->resize( splash->size() ); | 281 | //mView->resize( splash->size() ); |
282 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 282 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
283 | mView->readSettings(); | 283 | mView->readSettings(); |
284 | bool newFile = false; | 284 | bool newFile = false; |
285 | if( !QFile::exists( defaultFileName() ) ) { | 285 | if( !QFile::exists( defaultFileName() ) ) { |
286 | QFileInfo finfo ( defaultFileName() ); | 286 | QFileInfo finfo ( defaultFileName() ); |
287 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); | 287 | QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); |
288 | qDebug("oldfile %s ", oldFile.latin1()); | 288 | qDebug("oldfile %s ", oldFile.latin1()); |
289 | 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"; | 289 | 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"; |
290 | finfo.setFile( oldFile ); | 290 | finfo.setFile( oldFile ); |
291 | if (finfo.exists() ) { | 291 | if (finfo.exists() ) { |
292 | KMessageBox::information( this, message); | 292 | KMessageBox::information( this, message); |
293 | mView->openCalendar( oldFile ); | 293 | mView->openCalendar( oldFile ); |
294 | qApp->processEvents(); | 294 | qApp->processEvents(); |
295 | } else { | 295 | } else { |
296 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); | 296 | oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); |
297 | finfo.setFile( oldFile ); | 297 | finfo.setFile( oldFile ); |
298 | if (finfo.exists() ) { | 298 | if (finfo.exists() ) { |
299 | KMessageBox::information( this, message); | 299 | KMessageBox::information( this, message); |
300 | mView->openCalendar( oldFile ); | 300 | mView->openCalendar( oldFile ); |
301 | qApp->processEvents(); | 301 | qApp->processEvents(); |
302 | } | 302 | } |
303 | } | 303 | } |
304 | mView->saveCalendar( defaultFileName() ); | 304 | mView->saveCalendar( defaultFileName() ); |
305 | newFile = true; | 305 | newFile = true; |
306 | } | 306 | } |
307 | 307 | ||
308 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 308 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
309 | mView->openCalendar( defaultFileName() ); | 309 | mView->openCalendar( defaultFileName() ); |
310 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 310 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
311 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); | 311 | qDebug("KO: Calendar loading time: %d ms",msNeeded ); |
312 | 312 | ||
313 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { | 313 | if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { |
314 | KOPrefs::instance()->setAllDefaults(); | 314 | KOPrefs::instance()->setAllDefaults(); |
315 | int count = mView->addCategories(); | 315 | int count = mView->addCategories(); |
316 | } | 316 | } |
317 | processIncidenceSelection( 0 ); | 317 | processIncidenceSelection( 0 ); |
318 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), | 318 | connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), |
319 | SLOT( processIncidenceSelection( Incidence * ) ) ); | 319 | SLOT( processIncidenceSelection( Incidence * ) ) ); |
320 | connect( mView, SIGNAL( modifiedChanged( bool ) ), | 320 | connect( mView, SIGNAL( modifiedChanged( bool ) ), |
321 | SLOT( slotModifiedChanged( bool ) ) ); | 321 | SLOT( slotModifiedChanged( bool ) ) ); |
322 | 322 | ||
323 | 323 | ||
324 | connect( mView, SIGNAL( tempDisableBR(bool) ), | 324 | connect( mView, SIGNAL( tempDisableBR(bool) ), |
325 | SLOT( disableBR(bool) ) ); | 325 | SLOT( disableBR(bool) ) ); |
326 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); | 326 | connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); |
327 | mView->setModified( false ); | 327 | mView->setModified( false ); |
328 | mBlockAtStartup = false; | 328 | mBlockAtStartup = false; |
329 | mView->setModified( false ); | 329 | mView->setModified( false ); |
330 | setCentralWidget( mView ); | 330 | setCentralWidget( mView ); |
331 | globalFlagBlockStartup = 0; | 331 | globalFlagBlockStartup = 0; |
332 | mView->show(); | 332 | mView->show(); |
333 | delete splash; | 333 | delete splash; |
334 | if ( newFile ) | 334 | if ( newFile ) |
335 | mView->updateConfig(); | 335 | mView->updateConfig(); |
336 | // qApp->processEvents(); | 336 | // qApp->processEvents(); |
337 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); | 337 | //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); |
338 | //fillSyncMenu(); | 338 | //fillSyncMenu(); |
339 | 339 | ||
340 | 340 | ||
341 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); | 341 | connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); |
342 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); | 342 | connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); |
343 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); | 343 | connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); |
344 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); | 344 | connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); |
345 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); | 345 | connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); |
346 | mSyncManager->setDefaultFileName( sentSyncFile()); | 346 | mSyncManager->setDefaultFileName( sentSyncFile()); |
347 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); | 347 | connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); |
348 | mSyncManager->fillSyncMenu(); | 348 | mSyncManager->fillSyncMenu(); |
349 | 349 | ||
350 | 350 | ||
351 | 351 | ||
352 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); | 352 | mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); |
353 | if ( showWarning ) { | 353 | if ( showWarning ) { |
354 | KMessageBox::information( this, | 354 | KMessageBox::information( this, |
355 | "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"); | 355 | "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"); |
356 | qApp->processEvents(); | 356 | qApp->processEvents(); |
357 | mView->dialogManager()->showSyncOptions(); | 357 | mView->dialogManager()->showSyncOptions(); |
358 | } | 358 | } |
359 | 359 | ||
360 | //US listen for result adressed from Ka/Pi | 360 | //US listen for result adressed from Ka/Pi |
361 | #ifndef DESKTOP_VERSION | 361 | #ifndef DESKTOP_VERSION |
362 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); | 362 | connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); |
363 | #endif | 363 | #endif |
364 | #ifndef DESKTOP_VERSION | 364 | #ifndef DESKTOP_VERSION |
365 | infrared = 0; | 365 | infrared = 0; |
366 | #endif | 366 | #endif |
367 | updateFilterToolbar(); | 367 | updateFilterToolbar(); |
368 | updateWeek( mView->startDate() ); | 368 | updateWeek( mView->startDate() ); |
369 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), | 369 | connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), |
370 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); | 370 | SLOT( updateWeekNum( const KCal::DateList & ) ) ); |
371 | mBRdisabled = false; | 371 | mBRdisabled = false; |
372 | //toggleBeamReceive(); | 372 | //toggleBeamReceive(); |
373 | } | 373 | } |
374 | MainWindow::~MainWindow() | 374 | MainWindow::~MainWindow() |
375 | { | 375 | { |
376 | //qDebug("MainWindow::~MainWindow() "); | 376 | //qDebug("MainWindow::~MainWindow() "); |
377 | //save toolbar location | 377 | //save toolbar location |
378 | delete mCalendar; | 378 | delete mCalendar; |
379 | delete mSyncManager; | 379 | delete mSyncManager; |
380 | #ifndef DESKTOP_VERSION | 380 | #ifndef DESKTOP_VERSION |
381 | if ( infrared ) | 381 | if ( infrared ) |
382 | delete infrared; | 382 | delete infrared; |
383 | #endif | 383 | #endif |
384 | 384 | ||
385 | 385 | ||
386 | } | 386 | } |
387 | 387 | ||
388 | void MainWindow::disableBR(bool b) | 388 | void MainWindow::disableBR(bool b) |
389 | { | 389 | { |
390 | #ifndef DESKTOP_VERSION | 390 | #ifndef DESKTOP_VERSION |
391 | if ( b ) { | 391 | if ( b ) { |
392 | if ( infrared ) { | 392 | if ( infrared ) { |
393 | toggleBeamReceive(); | 393 | toggleBeamReceive(); |
394 | mBRdisabled = true; | 394 | mBRdisabled = true; |
395 | } | 395 | } |
396 | mBRdisabled = true; | 396 | mBRdisabled = true; |
397 | } else { | 397 | } else { |
398 | if ( mBRdisabled ) { | 398 | if ( mBRdisabled ) { |
399 | mBRdisabled = false; | 399 | mBRdisabled = false; |
400 | //makes no sense,because other cal ap is probably running | 400 | //makes no sense,because other cal ap is probably running |
401 | // toggleBeamReceive(); | 401 | // toggleBeamReceive(); |
402 | } | 402 | } |
403 | } | 403 | } |
404 | #endif | 404 | #endif |
405 | 405 | ||
406 | } | 406 | } |
407 | bool MainWindow::beamReceiveEnabled() | 407 | bool MainWindow::beamReceiveEnabled() |
408 | { | 408 | { |
409 | #ifndef DESKTOP_VERSION | 409 | #ifndef DESKTOP_VERSION |
410 | return ( infrared != 0 ); | 410 | return ( infrared != 0 ); |
411 | #endif | 411 | #endif |
412 | return false; | 412 | return false; |
413 | } | 413 | } |
414 | 414 | ||
415 | void MainWindow::toggleBeamReceive() | 415 | void MainWindow::toggleBeamReceive() |
416 | { | 416 | { |
417 | if ( mBRdisabled ) | 417 | if ( mBRdisabled ) |
418 | return; | 418 | return; |
419 | #ifndef DESKTOP_VERSION | 419 | #ifndef DESKTOP_VERSION |
420 | if ( infrared ) { | 420 | if ( infrared ) { |
421 | qDebug("disable BeamReceive "); | 421 | qDebug("disable BeamReceive "); |
422 | delete infrared; | 422 | delete infrared; |
423 | infrared = 0; | 423 | infrared = 0; |
424 | brAction->setOn(false); | 424 | brAction->setOn(false); |
425 | return; | 425 | return; |
426 | } | 426 | } |
427 | qDebug("enable BeamReceive "); | 427 | qDebug("enable BeamReceive "); |
428 | brAction->setOn(true); | 428 | brAction->setOn(true); |
429 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; | 429 | infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; |
430 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); | 430 | QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); |
431 | #endif | 431 | #endif |
432 | } | 432 | } |
433 | void MainWindow::showMaximized () | 433 | void MainWindow::showMaximized () |
434 | { | 434 | { |
435 | #ifndef DESKTOP_VERSION | 435 | #ifndef DESKTOP_VERSION |
436 | if ( ! globalFlagBlockStartup ) | 436 | if ( ! globalFlagBlockStartup ) |
437 | if ( mClosed ) | 437 | if ( mClosed ) |
438 | mView->goToday(); | 438 | mView->goToday(); |
439 | #endif | 439 | #endif |
440 | QWidget::showMaximized () ; | 440 | QWidget::showMaximized () ; |
441 | mClosed = false; | 441 | mClosed = false; |
442 | } | 442 | } |
443 | void MainWindow::closeEvent( QCloseEvent* ce ) | 443 | void MainWindow::closeEvent( QCloseEvent* ce ) |
444 | { | 444 | { |
445 | 445 | ||
446 | 446 | ||
447 | 447 | ||
448 | if ( ! KOPrefs::instance()->mAskForQuit ) { | 448 | if ( ! KOPrefs::instance()->mAskForQuit ) { |
449 | saveOnClose(); | 449 | saveOnClose(); |
450 | mClosed = true; | 450 | mClosed = true; |
451 | ce->accept(); | 451 | ce->accept(); |
452 | return; | 452 | return; |
453 | 453 | ||
454 | } | 454 | } |
455 | 455 | ||
456 | switch( QMessageBox::information( this, "KO/Pi", | 456 | switch( QMessageBox::information( this, "KO/Pi", |
457 | i18n("Do you really want\nto close KO/Pi?"), | 457 | i18n("Do you really want\nto close KO/Pi?"), |
458 | i18n("Close"), i18n("No"), | 458 | i18n("Close"), i18n("No"), |
459 | 0, 0 ) ) { | 459 | 0, 0 ) ) { |
460 | case 0: | 460 | case 0: |
461 | saveOnClose(); | 461 | saveOnClose(); |
462 | mClosed = true; | 462 | mClosed = true; |
463 | ce->accept(); | 463 | ce->accept(); |
464 | break; | 464 | break; |
465 | case 1: | 465 | case 1: |
466 | ce->ignore(); | 466 | ce->ignore(); |
467 | break; | 467 | break; |
468 | case 2: | 468 | case 2: |
469 | 469 | ||
470 | default: | 470 | default: |
471 | break; | 471 | break; |
472 | } | 472 | } |
473 | 473 | ||
474 | 474 | ||
475 | } | 475 | } |
476 | 476 | ||
477 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) | 477 | void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) |
478 | { | 478 | { |
479 | QDataStream stream( data, IO_ReadOnly ); | 479 | QDataStream stream( data, IO_ReadOnly ); |
480 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); | 480 | // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); |
481 | //QString datamess; | 481 | //QString datamess; |
482 | //qDebug("message "); | 482 | //qDebug("message "); |
483 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); | 483 | qDebug("KO: QCOP message received: %s ", cmsg.data() ); |
484 | 484 | ||
485 | if ( cmsg == "setDocument(QString)" ) { | 485 | if ( cmsg == "setDocument(QString)" ) { |
486 | QDataStream stream( data, IO_ReadOnly ); | 486 | QDataStream stream( data, IO_ReadOnly ); |
487 | QString fileName; | 487 | QString fileName; |
488 | stream >> fileName; | 488 | stream >> fileName; |
489 | //qDebug("filename %s ", fileName.latin1()); | 489 | //qDebug("filename %s ", fileName.latin1()); |
490 | showMaximized(); | 490 | showMaximized(); |
491 | raise(); | 491 | raise(); |
492 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; | 492 | KOPrefs::instance()->mLastSyncedLocalFile = fileName ; |
493 | mSyncManager->slotSyncMenu( 1002 ); | 493 | mSyncManager->slotSyncMenu( 1002 ); |
494 | return; | 494 | return; |
495 | } | 495 | } |
496 | 496 | ||
497 | if ( cmsg == "-writeFile" ) { | 497 | if ( cmsg == "-writeFile" ) { |
498 | // I made from the "-writeFile" an "-writeAlarm" | 498 | // I made from the "-writeFile" an "-writeAlarm" |
499 | mView->viewManager()->showWhatsNextView(); | 499 | mView->viewManager()->showWhatsNextView(); |
500 | mCalendar->checkAlarmForIncidence( 0, true); | 500 | mCalendar->checkAlarmForIncidence( 0, true); |
501 | showMaximized(); | 501 | showMaximized(); |
502 | raise(); | 502 | raise(); |
503 | return; | 503 | return; |
504 | 504 | ||
505 | } | 505 | } |
506 | if ( cmsg == "-writeFileSilent" ) { | 506 | if ( cmsg == "-writeFileSilent" ) { |
507 | // I made from the "-writeFile" an "-writeAlarm" | 507 | // I made from the "-writeFile" an "-writeAlarm" |
508 | // mView->viewManager()->showWhatsNextView(); | 508 | // mView->viewManager()->showWhatsNextView(); |
509 | mCalendar->checkAlarmForIncidence( 0, true); | 509 | mCalendar->checkAlarmForIncidence( 0, true); |
510 | //showMaximized(); | 510 | //showMaximized(); |
511 | //raise(); | 511 | //raise(); |
512 | hide(); | 512 | hide(); |
513 | return; | 513 | return; |
514 | } | 514 | } |
515 | if ( cmsg == "-newCountdown" ) { | 515 | if ( cmsg == "-newCountdown" ) { |
516 | qDebug("newCountdown "); | 516 | qDebug("newCountdown "); |
517 | 517 | ||
518 | } | 518 | } |
519 | QString msg ; | 519 | QString msg ; |
520 | QString allmsg = cmsg; | 520 | QString allmsg = cmsg; |
521 | while ( allmsg.length() > 0 ) { | 521 | while ( allmsg.length() > 0 ) { |
522 | int nextC = allmsg.find( "-", 1 ); | 522 | int nextC = allmsg.find( "-", 1 ); |
523 | if ( nextC == -1 ) { | 523 | if ( nextC == -1 ) { |
524 | msg = allmsg; | 524 | msg = allmsg; |
525 | allmsg = ""; | 525 | allmsg = ""; |
526 | } else{ | 526 | } else{ |
527 | msg = allmsg.left( nextC ); | 527 | msg = allmsg.left( nextC ); |
528 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); | 528 | allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); |
529 | } | 529 | } |
530 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); | 530 | //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); |
531 | if ( msg == "-newEvent" ) { | 531 | if ( msg == "-newEvent" ) { |
532 | mView->newEvent(); | 532 | mView->newEvent(); |
533 | } | 533 | } |
534 | if ( msg == "-newTodo" ) { | 534 | if ( msg == "-newTodo" ) { |
535 | mView->newTodo(); | 535 | mView->newTodo(); |
536 | 536 | ||
537 | } | 537 | } |
538 | if ( msg == "-showWN" ) { | 538 | if ( msg == "-showWN" ) { |
539 | mView->viewManager()->showWhatsNextView(); | 539 | mView->viewManager()->showWhatsNextView(); |
540 | } | 540 | } |
541 | if ( msg == "-showTodo" ) { | 541 | if ( msg == "-showTodo" ) { |
542 | mView->viewManager()->showTodoView(); | 542 | mView->viewManager()->showTodoView(); |
543 | } | 543 | } |
544 | if ( msg == "-showList" ) { | 544 | if ( msg == "-showList" ) { |
545 | mView->viewManager()->showListView(); | 545 | mView->viewManager()->showListView(); |
546 | } | 546 | } |
547 | else if ( msg == "-showDay" ) { | 547 | else if ( msg == "-showDay" ) { |
548 | mView->viewManager()->showDayView(); | 548 | mView->viewManager()->showDayView(); |
549 | } | 549 | } |
550 | else if ( msg == "-showWWeek" ) { | 550 | else if ( msg == "-showWWeek" ) { |
551 | mView->viewManager()->showWorkWeekView(); | 551 | mView->viewManager()->showWorkWeekView(); |
552 | } | 552 | } |
553 | else if ( msg == "-ringSync" ) { | 553 | else if ( msg == "-ringSync" ) { |
554 | mSyncManager->multiSync( false ); | 554 | mSyncManager->multiSync( false ); |
555 | } | 555 | } |
556 | else if ( msg == "-showWeek" ) { | 556 | else if ( msg == "-showWeek" ) { |
557 | mView->viewManager()->showWeekView(); | 557 | mView->viewManager()->showWeekView(); |
558 | } | 558 | } |
559 | else if ( msg == "-showTodo" ) { | 559 | else if ( msg == "-showTodo" ) { |
560 | mView->viewManager()->showTodoView(); | 560 | mView->viewManager()->showTodoView(); |
561 | } | 561 | } |
562 | else if ( msg == "-showJournal" ) { | 562 | else if ( msg == "-showJournal" ) { |
563 | mView->dateNavigator()->selectDates( 1 ); | 563 | mView->dateNavigator()->selectDates( 1 ); |
564 | mView->dateNavigator()->selectToday(); | 564 | mView->dateNavigator()->selectToday(); |
565 | mView->viewManager()->showJournalView(); | 565 | mView->viewManager()->showJournalView(); |
566 | } | 566 | } |
567 | else if ( msg == "-showKO" ) { | 567 | else if ( msg == "-showKO" ) { |
568 | mView->viewManager()->showNextXView(); | 568 | mView->viewManager()->showNextXView(); |
569 | } | 569 | } |
570 | else if ( msg == "-showWNext" ) { | 570 | else if ( msg == "-showWNext" ) { |
571 | mView->viewManager()->showWhatsNextView(); | 571 | mView->viewManager()->showWhatsNextView(); |
572 | } | 572 | } |
573 | else if ( msg == "nextView()" ) { | 573 | else if ( msg == "nextView()" ) { |
574 | mView->viewManager()->showNextView(); | 574 | mView->viewManager()->showNextView(); |
575 | } | 575 | } |
576 | else if ( msg == "-showNextXView" ) { | 576 | else if ( msg == "-showNextXView" ) { |
577 | mView->viewManager()->showNextXView(); | 577 | mView->viewManager()->showNextXView(); |
578 | } | 578 | } |
579 | 579 | ||
580 | 580 | ||
581 | } | 581 | } |
582 | 582 | ||
583 | showMaximized(); | 583 | showMaximized(); |
584 | raise(); | 584 | raise(); |
585 | } | 585 | } |
586 | 586 | ||
587 | QPixmap MainWindow::loadPixmap( QString name ) | 587 | QPixmap MainWindow::loadPixmap( QString name ) |
588 | { | 588 | { |
589 | return SmallIcon( name ); | 589 | return SmallIcon( name ); |
590 | 590 | ||
591 | } | 591 | } |
592 | void MainWindow::initActions() | 592 | void MainWindow::initActions() |
593 | { | 593 | { |
594 | //KOPrefs::instance()->mShowFullMenu | 594 | //KOPrefs::instance()->mShowFullMenu |
595 | iconToolBar->clear(); | 595 | iconToolBar->clear(); |
596 | KOPrefs *p = KOPrefs::instance(); | 596 | KOPrefs *p = KOPrefs::instance(); |
597 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); | 597 | //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); |
598 | 598 | ||
599 | QPopupMenu *viewMenu = new QPopupMenu( this ); | 599 | QPopupMenu *viewMenu = new QPopupMenu( this ); |
600 | QPopupMenu *actionMenu = new QPopupMenu( this ); | 600 | QPopupMenu *actionMenu = new QPopupMenu( this ); |
601 | QPopupMenu *importMenu = new QPopupMenu( this ); | 601 | QPopupMenu *importMenu = new QPopupMenu( this ); |
602 | QPopupMenu *importMenu_X = new QPopupMenu( this ); | 602 | QPopupMenu *importMenu_X = new QPopupMenu( this ); |
603 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); | 603 | QPopupMenu *exportMenu_X = new QPopupMenu( this ); |
604 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); | 604 | QPopupMenu *beamMenu_X = new QPopupMenu( this ); |
605 | selectFilterMenu = new QPopupMenu( this ); | 605 | selectFilterMenu = new QPopupMenu( this ); |
606 | selectFilterMenu->setCheckable( true ); | 606 | selectFilterMenu->setCheckable( true ); |
607 | syncMenu = new QPopupMenu( this ); | 607 | syncMenu = new QPopupMenu( this ); |
608 | configureAgendaMenu = new QPopupMenu( this ); | 608 | configureAgendaMenu = new QPopupMenu( this ); |
609 | configureToolBarMenu = new QPopupMenu( this ); | 609 | configureToolBarMenu = new QPopupMenu( this ); |
610 | QPopupMenu *helpMenu = new QPopupMenu( this ); | 610 | QPopupMenu *helpMenu = new QPopupMenu( this ); |
611 | QIconSet icon; | 611 | QIconSet icon; |
612 | int pixWid = 22, pixHei = 22; | 612 | int pixWid = 22, pixHei = 22; |
613 | QString pathString = ""; | 613 | QString pathString = ""; |
614 | if ( !p->mToolBarMiniIcons ) { | 614 | if ( !p->mToolBarMiniIcons ) { |
615 | if ( QApplication::desktop()->width() < 480 ) { | 615 | if ( QApplication::desktop()->width() < 480 ) { |
616 | pathString += "icons16/"; | 616 | pathString += "icons16/"; |
617 | pixWid = 18; pixHei = 16; | 617 | pixWid = 18; pixHei = 16; |
618 | } | 618 | } |
619 | } else { | 619 | } else { |
620 | pathString += "iconsmini/"; | 620 | pathString += "iconsmini/"; |
621 | pixWid = 18; pixHei = 16; | 621 | pixWid = 18; pixHei = 16; |
622 | } | 622 | } |
623 | if ( KOPrefs::instance()->mShowFullMenu ) { | 623 | if ( KOPrefs::instance()->mShowFullMenu ) { |
624 | QMenuBar *menuBar1; | 624 | QMenuBar *menuBar1; |
625 | menuBar1 = menuBar(); | 625 | menuBar1 = menuBar(); |
626 | menuBar1->insertItem( i18n("File"), importMenu ); | 626 | menuBar1->insertItem( i18n("File"), importMenu ); |
627 | menuBar1->insertItem( i18n("View"), viewMenu ); | 627 | menuBar1->insertItem( i18n("View"), viewMenu ); |
628 | menuBar1->insertItem( i18n("Actions"), actionMenu ); | 628 | menuBar1->insertItem( i18n("Actions"), actionMenu ); |
629 | #ifdef DESKTOP_VERSION | 629 | #ifdef DESKTOP_VERSION |
630 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); | 630 | menuBar1->insertItem( i18n("Synchronize"), syncMenu ); |
631 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 631 | menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
632 | #else | 632 | #else |
633 | menuBar1->insertItem( i18n("Sync"), syncMenu ); | 633 | menuBar1->insertItem( i18n("Sync"), syncMenu ); |
634 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); | 634 | menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); |
635 | #endif | 635 | #endif |
636 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 636 | //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
637 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); | 637 | menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); |
638 | menuBar1->insertItem( i18n("Help"), helpMenu ); | 638 | menuBar1->insertItem( i18n("Help"), helpMenu ); |
639 | } else { | 639 | } else { |
640 | QPEMenuBar *menuBar1; | 640 | QPEMenuBar *menuBar1; |
641 | menuBar1 = new QPEMenuBar( iconToolBar ); | 641 | menuBar1 = new QPEMenuBar( iconToolBar ); |
642 | QPopupMenu *menuBar = new QPopupMenu( this ); | 642 | QPopupMenu *menuBar = new QPopupMenu( this ); |
643 | icon = loadPixmap( pathString + "z_menu" ); | 643 | icon = loadPixmap( pathString + "z_menu" ); |
644 | menuBar1->insertItem( icon.pixmap(), menuBar); | 644 | menuBar1->insertItem( icon.pixmap(), menuBar); |
645 | //menuBar1->insertItem( i18n("ME"), menuBar); | 645 | //menuBar1->insertItem( i18n("ME"), menuBar); |
646 | menuBar->insertItem( i18n("File"), importMenu ); | 646 | menuBar->insertItem( i18n("File"), importMenu ); |
647 | menuBar->insertItem( i18n("View"), viewMenu ); | 647 | menuBar->insertItem( i18n("View"), viewMenu ); |
648 | menuBar->insertItem( i18n("Actions"), actionMenu ); | 648 | menuBar->insertItem( i18n("Actions"), actionMenu ); |
649 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); | 649 | menuBar->insertItem( i18n("Synchronize"), syncMenu ); |
650 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); | 650 | menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); |
651 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); | 651 | menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); |
652 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); | 652 | menuBar->insertItem( i18n("Filter"),selectFilterMenu ); |
653 | menuBar->insertItem( i18n("Help"), helpMenu ); | 653 | menuBar->insertItem( i18n("Help"), helpMenu ); |
654 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); | 654 | //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); |
655 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); | 655 | menuBar1->setMaximumSize( menuBar1->sizeHint( )); |
656 | } | 656 | } |
657 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 657 | connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
658 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); | 658 | connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); |
659 | 659 | ||
660 | 660 | ||
661 | mWeekBgColor = iconToolBar->backgroundColor(); | 661 | mWeekBgColor = iconToolBar->backgroundColor(); |
662 | mWeekPixmap.resize( pixWid , pixHei ); | 662 | mWeekPixmap.resize( pixWid , pixHei ); |
663 | mWeekPixmap.fill( mWeekBgColor ); | 663 | mWeekPixmap.fill( mWeekBgColor ); |
664 | icon = mWeekPixmap; | 664 | icon = mWeekPixmap; |
665 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); | 665 | mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); |
666 | if ( p-> mShowIconWeekNum ) | 666 | if ( p-> mShowIconWeekNum ) |
667 | mWeekAction->addTo( iconToolBar ); | 667 | mWeekAction->addTo( iconToolBar ); |
668 | mWeekFont = font(); | 668 | mWeekFont = font(); |
669 | 669 | ||
670 | int fontPoint = mWeekFont.pointSize(); | 670 | int fontPoint = mWeekFont.pointSize(); |
671 | QFontMetrics f( mWeekFont ); | 671 | QFontMetrics f( mWeekFont ); |
672 | int fontWid = f.width( "30" ); | 672 | int fontWid = f.width( "30" ); |
673 | while ( fontWid > pixWid ) { | 673 | while ( fontWid > pixWid ) { |
674 | --fontPoint; | 674 | --fontPoint; |
675 | mWeekFont.setPointSize( fontPoint ); | 675 | mWeekFont.setPointSize( fontPoint ); |
676 | QFontMetrics f( mWeekFont ); | 676 | QFontMetrics f( mWeekFont ); |
677 | fontWid = f.width( "30" ); | 677 | fontWid = f.width( "30" ); |
678 | //qDebug("dec-- "); | 678 | //qDebug("dec-- "); |
679 | } | 679 | } |
680 | 680 | ||
681 | connect( mWeekAction, SIGNAL( activated() ), | 681 | connect( mWeekAction, SIGNAL( activated() ), |
682 | this, SLOT( weekAction() ) ); | 682 | this, SLOT( weekAction() ) ); |
683 | 683 | ||
684 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); | 684 | connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); |
685 | if ( p->mShowIconFilterview ) { | 685 | if ( p->mShowIconFilterview ) { |
686 | icon = loadPixmap( pathString + "filter" ); | 686 | icon = loadPixmap( pathString + "filter" ); |
687 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); | 687 | actionFilterMenuTB = new QAction( i18n("Filter selector"), icon, i18n("Filter selector"), 0, this ); |
688 | connect( actionFilterMenuTB, SIGNAL( activated() ), | 688 | connect( actionFilterMenuTB, SIGNAL( activated() ), |
689 | this, SLOT( fillFilterMenuTB() ) ); | 689 | this, SLOT( fillFilterMenuTB() ) ); |
690 | actionFilterMenuTB->addTo( iconToolBar ); | 690 | actionFilterMenuTB->addTo( iconToolBar ); |
691 | selectFilterMenuTB = new QPopupMenu( this ); | 691 | selectFilterMenuTB = new QPopupMenu( this ); |
692 | selectFilterMenuTB->setCheckable( true ); | 692 | selectFilterMenuTB->setCheckable( true ); |
693 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); | 693 | connect ( selectFilterMenuTB, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); |
694 | } | 694 | } |
695 | 695 | ||
696 | //#endif | 696 | //#endif |
697 | // ****************** | 697 | // ****************** |
698 | QAction *action; | 698 | QAction *action; |
699 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); | 699 | // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); |
700 | configureToolBarMenu->setCheckable( true ); | 700 | configureToolBarMenu->setCheckable( true ); |
701 | 701 | ||
702 | 702 | ||
703 | configureAgendaMenu->setCheckable( true ); | 703 | configureAgendaMenu->setCheckable( true ); |
704 | int iii ; | 704 | int iii ; |
705 | for ( iii = 1;iii<= 10 ;++iii ){ | 705 | for ( iii = 1;iii<= 10 ;++iii ){ |
706 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); | 706 | configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); |
707 | } | 707 | } |
708 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); | 708 | //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); |
709 | 709 | ||
710 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), | 710 | connect( configureAgendaMenu, SIGNAL( aboutToShow()), |
711 | this, SLOT( showConfigureAgenda( ) ) ); | 711 | this, SLOT( showConfigureAgenda( ) ) ); |
712 | 712 | ||
713 | icon = loadPixmap( pathString + "configure" ); | 713 | icon = loadPixmap( pathString + "configure" ); |
714 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); | 714 | action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); |
715 | action->addTo( actionMenu ); | 715 | action->addTo( actionMenu ); |
716 | connect( action, SIGNAL( activated() ), | 716 | connect( action, SIGNAL( activated() ), |
717 | mView, SLOT( edit_options() ) ); | 717 | mView, SLOT( edit_options() ) ); |
718 | actionMenu->insertSeparator(); | 718 | actionMenu->insertSeparator(); |
719 | 719 | ||
720 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); | 720 | action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); |
721 | action->addTo( actionMenu ); | 721 | action->addTo( actionMenu ); |
722 | connect( action, SIGNAL( activated() ), | 722 | connect( action, SIGNAL( activated() ), |
723 | mView, SLOT( undo_delete() ) ); | 723 | mView, SLOT( undo_delete() ) ); |
724 | actionMenu->insertSeparator(); | 724 | actionMenu->insertSeparator(); |
725 | 725 | ||
726 | icon = loadPixmap( pathString + "newevent" ); | 726 | icon = loadPixmap( pathString + "newevent" ); |
727 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); | 727 | configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); |
728 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); | 728 | configureToolBarMenu->insertItem(i18n("Only one toolbar"), 6 ); |
729 | configureToolBarMenu->insertSeparator(); | 729 | configureToolBarMenu->insertSeparator(); |
730 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); | 730 | configureToolBarMenu->insertItem(i18n("Filtermenu"), 7 ); |
731 | configureToolBarMenu->insertSeparator(); | 731 | configureToolBarMenu->insertSeparator(); |
732 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); | 732 | configureToolBarMenu->insertItem(i18n("Week Number"), 400); |
733 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); | 733 | configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); |
734 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); | 734 | QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); |
735 | ne_action->addTo( actionMenu ); | 735 | ne_action->addTo( actionMenu ); |
736 | connect( ne_action, SIGNAL( activated() ), | 736 | connect( ne_action, SIGNAL( activated() ), |
737 | mView, SLOT( newEvent() ) ); | 737 | mView, SLOT( newEvent() ) ); |
738 | icon = loadPixmap( pathString + "newtodo" ); | 738 | icon = loadPixmap( pathString + "newtodo" ); |
739 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); | 739 | configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); |
740 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); | 740 | QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); |
741 | nt_action->addTo( actionMenu ); | 741 | nt_action->addTo( actionMenu ); |
742 | connect( nt_action, SIGNAL( activated() ), | 742 | connect( nt_action, SIGNAL( activated() ), |
743 | mView, SLOT( newTodo() ) ); | 743 | mView, SLOT( newTodo() ) ); |
744 | 744 | ||
745 | icon = loadPixmap( pathString + "today" ); | 745 | icon = loadPixmap( pathString + "today" ); |
746 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); | 746 | QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); |
747 | today_action->addTo( viewMenu ); | 747 | today_action->addTo( viewMenu ); |
748 | connect( today_action, SIGNAL( activated() ), | 748 | connect( today_action, SIGNAL( activated() ), |
749 | mView, SLOT( goToday() ) ); | 749 | mView, SLOT( goToday() ) ); |
750 | viewMenu->insertSeparator(); | 750 | viewMenu->insertSeparator(); |
751 | 751 | ||
752 | // *********************** | 752 | // *********************** |
753 | if ( KOPrefs::instance()->mVerticalScreen ) { | 753 | if ( KOPrefs::instance()->mVerticalScreen ) { |
754 | icon = SmallIcon( "1updownarrow" ); | 754 | icon = SmallIcon( "1updownarrow" ); |
755 | } else { | 755 | } else { |
756 | icon = SmallIcon("1leftrightarrow" ); | 756 | icon = SmallIcon("1leftrightarrow" ); |
757 | } | 757 | } |
758 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); | 758 | configureToolBarMenu->insertItem(icon, i18n("Toggle Fullscreen"), 28 ); |
759 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); | 759 | QAction* FSaction = new QAction( i18n("Toggle Fullscreen"), icon, i18n("Toggle Fullscreen"), 0, this ); |
760 | FSaction->addTo( viewMenu ); | 760 | FSaction->addTo( viewMenu ); |
761 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); | 761 | connect( FSaction, SIGNAL( activated() ), mView, SLOT( toggleExpand() )); |
762 | 762 | ||
763 | icon = loadPixmap( pathString + "navi" ); | 763 | icon = loadPixmap( pathString + "navi" ); |
764 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); | 764 | configureToolBarMenu->insertItem(icon, i18n("Toggle DateNavigator"), 22 ); |
765 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); | 765 | action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); |
766 | action->addTo( viewMenu ); | 766 | action->addTo( viewMenu ); |
767 | connect( action, SIGNAL( activated() ), | 767 | connect( action, SIGNAL( activated() ), |
768 | mView, SLOT( toggleDateNavigatorWidget() ) ); | 768 | mView, SLOT( toggleDateNavigatorWidget() ) ); |
769 | mToggleNav = action ; | 769 | mToggleNav = action ; |
770 | icon = loadPixmap( pathString + "filter" ); | 770 | icon = loadPixmap( pathString + "filter" ); |
771 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); | 771 | configureToolBarMenu->insertItem(icon, i18n("Filter menu icon"), 26 ); |
772 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); | 772 | action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); |
773 | action->addTo( viewMenu ); | 773 | action->addTo( viewMenu ); |
774 | connect( action, SIGNAL( activated() ), | 774 | connect( action, SIGNAL( activated() ), |
775 | mView, SLOT( toggleFilter() ) ); | 775 | mView, SLOT( toggleFilter() ) ); |
776 | mToggleFilter = action; | 776 | mToggleFilter = action; |
777 | icon = loadPixmap( pathString + "allday" ); | 777 | icon = loadPixmap( pathString + "allday" ); |
778 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); | 778 | configureToolBarMenu->insertItem(icon, i18n("Toggle Allday"), 24 ); |
779 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); | 779 | action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); |
780 | action->addTo( viewMenu ); | 780 | action->addTo( viewMenu ); |
781 | connect( action, SIGNAL( activated() ), | 781 | connect( action, SIGNAL( activated() ), |
782 | mView, SLOT( toggleAllDaySize() ) ); | 782 | mView, SLOT( toggleAllDaySize() ) ); |
783 | mToggleAllday = action; | 783 | mToggleAllday = action; |
784 | 784 | ||
785 | 785 | ||
786 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 786 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
787 | mToggleNav, SLOT( setEnabled ( bool ) ) ); | 787 | mToggleNav, SLOT( setEnabled ( bool ) ) ); |
788 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), | 788 | connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), |
789 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); | 789 | mToggleFilter, SLOT( setEnabled ( bool ) ) ); |
790 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), | 790 | connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), |
791 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); | 791 | mToggleAllday, SLOT( setEnabled ( bool ) ) ); |
792 | 792 | ||
793 | viewMenu->insertSeparator(); | 793 | viewMenu->insertSeparator(); |
794 | icon = loadPixmap( pathString + "picker" ); | 794 | icon = loadPixmap( pathString + "picker" ); |
795 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); | 795 | action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); |
796 | action->addTo( viewMenu ); | 796 | action->addTo( viewMenu ); |
797 | connect( action, SIGNAL( activated() ), | 797 | connect( action, SIGNAL( activated() ), |
798 | mView, SLOT( showDatePicker() ) ); | 798 | mView, SLOT( showDatePicker() ) ); |
799 | action->addTo( iconToolBar ); | 799 | action->addTo( iconToolBar ); |
800 | viewMenu->insertSeparator(); | 800 | viewMenu->insertSeparator(); |
801 | 801 | ||
802 | if ( p-> mShowIconToggleFull ) | 802 | if ( p-> mShowIconToggleFull ) |
803 | FSaction->addTo( iconToolBar ); | 803 | FSaction->addTo( iconToolBar ); |
804 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); | 804 | if ( p->mShowIconNavigator ) mToggleNav ->addTo( iconToolBar ); |
805 | 805 | ||
806 | //******************** | 806 | //******************** |
807 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); | 807 | if ( p->mShowIconAllday ) mToggleAllday->addTo( iconToolBar ); |
808 | 808 | ||
809 | 809 | ||
810 | icon = loadPixmap( pathString + "whatsnext" ); | 810 | icon = loadPixmap( pathString + "whatsnext" ); |
811 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); | 811 | configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 ); |
812 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); | 812 | QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); |
813 | whatsnext_action->addTo( viewMenu ); | 813 | whatsnext_action->addTo( viewMenu ); |
814 | connect( whatsnext_action, SIGNAL( activated() ), | 814 | connect( whatsnext_action, SIGNAL( activated() ), |
815 | mView->viewManager(), SLOT( showWhatsNextView() ) ); | 815 | mView->viewManager(), SLOT( showWhatsNextView() ) ); |
816 | 816 | ||
817 | icon = loadPixmap( pathString + "xdays" ); | 817 | icon = loadPixmap( pathString + "xdays" ); |
818 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); | 818 | configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 ); |
819 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); | 819 | QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); |
820 | xdays_action->addTo( viewMenu ); | 820 | xdays_action->addTo( viewMenu ); |
821 | connect( xdays_action, SIGNAL( activated() ), | 821 | connect( xdays_action, SIGNAL( activated() ), |
822 | mView->viewManager(), SLOT( showNextXView() ) ); | 822 | mView->viewManager(), SLOT( showNextXView() ) ); |
823 | 823 | ||
824 | 824 | ||
825 | icon = loadPixmap( pathString + "journal" ); | 825 | icon = loadPixmap( pathString + "journal" ); |
826 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); | 826 | configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); |
827 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); | 827 | QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); |
828 | viewjournal_action->addTo( viewMenu ); | 828 | viewjournal_action->addTo( viewMenu ); |
829 | connect( viewjournal_action, SIGNAL( activated() ), | 829 | connect( viewjournal_action, SIGNAL( activated() ), |
830 | mView->viewManager(), SLOT( showJournalView() ) ); | 830 | mView->viewManager(), SLOT( showJournalView() ) ); |
831 | 831 | ||
832 | 832 | ||
833 | icon = loadPixmap( pathString + "day" ); | 833 | icon = loadPixmap( pathString + "day" ); |
834 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); | 834 | configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); |
835 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); | 835 | QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); |
836 | day1_action->addTo( viewMenu ); | 836 | day1_action->addTo( viewMenu ); |
837 | // action->addTo( toolBar ); | 837 | // action->addTo( toolBar ); |
838 | connect( day1_action, SIGNAL( activated() ), | 838 | connect( day1_action, SIGNAL( activated() ), |
839 | mView->viewManager(), SLOT( showDayView() ) ); | 839 | mView->viewManager(), SLOT( showDayView() ) ); |
840 | 840 | ||
841 | icon = loadPixmap( pathString + "workweek" ); | 841 | icon = loadPixmap( pathString + "workweek" ); |
842 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); | 842 | configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); |
843 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); | 843 | QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); |
844 | day5_action->addTo( viewMenu ); | 844 | day5_action->addTo( viewMenu ); |
845 | connect( day5_action, SIGNAL( activated() ), | 845 | connect( day5_action, SIGNAL( activated() ), |
846 | mView->viewManager(), SLOT( showWorkWeekView() ) ); | 846 | mView->viewManager(), SLOT( showWorkWeekView() ) ); |
847 | 847 | ||
848 | icon = loadPixmap( pathString + "week" ); | 848 | icon = loadPixmap( pathString + "week" ); |
849 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); | 849 | configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); |
850 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); | 850 | QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); |
851 | day7_action->addTo( viewMenu ); | 851 | day7_action->addTo( viewMenu ); |
852 | connect( day7_action, SIGNAL( activated() ), | 852 | connect( day7_action, SIGNAL( activated() ), |
853 | mView->viewManager(), SLOT( showWeekView() ) ); | 853 | mView->viewManager(), SLOT( showWeekView() ) ); |
854 | 854 | ||
855 | icon = loadPixmap( pathString + "workweek2" ); | 855 | icon = loadPixmap( pathString + "workweek2" ); |
856 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); | 856 | configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); |
857 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); | 857 | QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); |
858 | day6_action->addTo( viewMenu ); | 858 | day6_action->addTo( viewMenu ); |
859 | connect( day6_action, SIGNAL( activated() ), | 859 | connect( day6_action, SIGNAL( activated() ), |
860 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); | 860 | mView->viewManager(), SLOT( showMonthViewWeek() ) ); |
861 | 861 | ||
862 | icon = loadPixmap( pathString + "month" ); | 862 | icon = loadPixmap( pathString + "month" ); |
863 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); | 863 | configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); |
864 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); | 864 | QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); |
865 | month_action->addTo( viewMenu ); | 865 | month_action->addTo( viewMenu ); |
866 | connect( month_action, SIGNAL( activated() ), | 866 | connect( month_action, SIGNAL( activated() ), |
867 | mView->viewManager(), SLOT( showMonthView() ) ); | 867 | mView->viewManager(), SLOT( showMonthView() ) ); |
868 | 868 | ||
869 | icon = loadPixmap( pathString + "list" ); | 869 | icon = loadPixmap( pathString + "list" ); |
870 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); | 870 | configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); |
871 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); | 871 | QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); |
872 | showlist_action->addTo( viewMenu ); | 872 | showlist_action->addTo( viewMenu ); |
873 | connect( showlist_action, SIGNAL( activated() ), | 873 | connect( showlist_action, SIGNAL( activated() ), |
874 | mView->viewManager(), SLOT( showListView() ) ); | 874 | mView->viewManager(), SLOT( showListView() ) ); |
875 | 875 | ||
876 | icon = loadPixmap( pathString + "todo" ); | 876 | icon = loadPixmap( pathString + "todo" ); |
877 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); | 877 | configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); |
878 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); | 878 | QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); |
879 | todoview_action->addTo( viewMenu ); | 879 | todoview_action->addTo( viewMenu ); |
880 | connect( todoview_action, SIGNAL( activated() ), | 880 | connect( todoview_action, SIGNAL( activated() ), |
881 | mView->viewManager(), SLOT( showTodoView() ) ); | 881 | mView->viewManager(), SLOT( showTodoView() ) ); |
882 | 882 | ||
883 | 883 | ||
884 | 884 | ||
885 | #if 0 | 885 | #if 0 |
886 | action = new QAction( "view_timespan", "Time Span", 0, this ); | 886 | action = new QAction( "view_timespan", "Time Span", 0, this ); |
887 | action->addTo( viewMenu ); | 887 | action->addTo( viewMenu ); |
888 | connect( action, SIGNAL( activated() ), | 888 | connect( action, SIGNAL( activated() ), |
889 | mView->viewManager(), SLOT( showTimeSpanView() ) ); | 889 | mView->viewManager(), SLOT( showTimeSpanView() ) ); |
890 | #endif | 890 | #endif |
891 | 891 | ||
892 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, | 892 | mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, |
893 | this ); | 893 | this ); |
894 | mNewSubTodoAction->addTo( actionMenu ); | 894 | mNewSubTodoAction->addTo( actionMenu ); |
895 | connect( mNewSubTodoAction, SIGNAL( activated() ), | 895 | connect( mNewSubTodoAction, SIGNAL( activated() ), |
896 | mView, SLOT( newSubTodo() ) ); | 896 | mView, SLOT( newSubTodo() ) ); |
897 | 897 | ||
898 | actionMenu->insertSeparator(); | 898 | actionMenu->insertSeparator(); |
899 | 899 | ||
900 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); | 900 | mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); |
901 | mShowAction->addTo( actionMenu ); | 901 | mShowAction->addTo( actionMenu ); |
902 | connect( mShowAction, SIGNAL( activated() ), | 902 | connect( mShowAction, SIGNAL( activated() ), |
903 | mView, SLOT( showIncidence() ) ); | 903 | mView, SLOT( showIncidence() ) ); |
904 | 904 | ||
905 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); | 905 | mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); |
906 | mEditAction->addTo( actionMenu ); | 906 | mEditAction->addTo( actionMenu ); |
907 | connect( mEditAction, SIGNAL( activated() ), | 907 | connect( mEditAction, SIGNAL( activated() ), |
908 | mView, SLOT( editIncidence() ) ); | 908 | mView, SLOT( editIncidence() ) ); |
909 | 909 | ||
910 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); | 910 | mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); |
911 | mDeleteAction->addTo( actionMenu ); | 911 | mDeleteAction->addTo( actionMenu ); |
912 | connect( mDeleteAction, SIGNAL( activated() ), | 912 | connect( mDeleteAction, SIGNAL( activated() ), |
913 | mView, SLOT( deleteIncidence() ) ); | 913 | mView, SLOT( deleteIncidence() ) ); |
914 | 914 | ||
915 | 915 | ||
916 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); | 916 | mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); |
917 | mCloneAction->addTo( actionMenu ); | 917 | mCloneAction->addTo( actionMenu ); |
918 | connect( mCloneAction, SIGNAL( activated() ), | 918 | connect( mCloneAction, SIGNAL( activated() ), |
919 | mView, SLOT( cloneIncidence() ) ); | 919 | mView, SLOT( cloneIncidence() ) ); |
920 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); | 920 | mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); |
921 | mMoveAction->addTo( actionMenu ); | 921 | mMoveAction->addTo( actionMenu ); |
922 | connect( mMoveAction, SIGNAL( activated() ), | 922 | connect( mMoveAction, SIGNAL( activated() ), |
923 | mView, SLOT( moveIncidence() ) ); | 923 | mView, SLOT( moveIncidence() ) ); |
924 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); | 924 | mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); |
925 | mBeamAction->addTo( actionMenu ); | 925 | mBeamAction->addTo( actionMenu ); |
926 | connect( mBeamAction, SIGNAL( activated() ), | 926 | connect( mBeamAction, SIGNAL( activated() ), |
927 | mView, SLOT( beamIncidence() ) ); | 927 | mView, SLOT( beamIncidence() ) ); |
928 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); | 928 | mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); |
929 | mCancelAction->addTo( actionMenu ); | 929 | mCancelAction->addTo( actionMenu ); |
930 | connect( mCancelAction, SIGNAL( activated() ), | 930 | connect( mCancelAction, SIGNAL( activated() ), |
931 | mView, SLOT( toggleCancelIncidence() ) ); | 931 | mView, SLOT( toggleCancelIncidence() ) ); |
932 | 932 | ||
933 | actionMenu->insertSeparator(); | 933 | actionMenu->insertSeparator(); |
934 | 934 | ||
935 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, | 935 | action = new QAction( "purge_completed", i18n("Purge Completed"), 0, |
936 | this ); | 936 | this ); |
937 | action->addTo( actionMenu ); | 937 | action->addTo( actionMenu ); |
938 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); | 938 | connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); |
939 | 939 | ||
940 | icon = loadPixmap( pathString + "search" ); | 940 | icon = loadPixmap( pathString + "search" ); |
941 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); | 941 | QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); |
942 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); | 942 | configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5); |
943 | search_action->addTo( actionMenu ); | 943 | search_action->addTo( actionMenu ); |
944 | connect( search_action, SIGNAL( activated() ), | 944 | connect( search_action, SIGNAL( activated() ), |
945 | mView->dialogManager(), SLOT( showSearchDialog() ) ); | 945 | mView->dialogManager(), SLOT( showSearchDialog() ) ); |
946 | 946 | ||
947 | 947 | ||
948 | 948 | ||
949 | if ( KOPrefs::instance()->mShowFullMenu ) { | 949 | if ( KOPrefs::instance()->mShowFullMenu ) { |
950 | actionMenu->insertSeparator(); | 950 | actionMenu->insertSeparator(); |
951 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); | 951 | actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); |
952 | 952 | ||
953 | } | 953 | } |
954 | // actionMenu->insertSeparator(); | 954 | // actionMenu->insertSeparator(); |
955 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, | 955 | action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, |
956 | this ); | 956 | this ); |
957 | action->addTo( importMenu_X ); | 957 | action->addTo( importMenu_X ); |
958 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); | 958 | connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); |
959 | action = new QAction( "import_quick", i18n("Import last file"), 0, | 959 | action = new QAction( "import_quick", i18n("Import last file"), 0, |
960 | this ); | 960 | this ); |
961 | action->addTo( importMenu_X ); | 961 | action->addTo( importMenu_X ); |
962 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); | 962 | connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); |
963 | importMenu_X->insertSeparator(); | 963 | importMenu_X->insertSeparator(); |
964 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, | 964 | action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, |
965 | this ); | 965 | this ); |
966 | action->addTo( importMenu_X ); | 966 | action->addTo( importMenu_X ); |
967 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); | 967 | connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); |
968 | //#ifndef DESKTOP_VERSION | 968 | //#ifndef DESKTOP_VERSION |
969 | importMenu_X->insertSeparator(); | 969 | importMenu_X->insertSeparator(); |
970 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, | 970 | action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, |
971 | this ); | 971 | this ); |
972 | action->addTo( importMenu_X ); | 972 | action->addTo( importMenu_X ); |
973 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); | 973 | connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); |
974 | //#else | 974 | //#else |
975 | #ifdef _OL_IMPORT_ | 975 | #ifdef _OL_IMPORT_ |
976 | importMenu_X->insertSeparator(); | 976 | importMenu_X->insertSeparator(); |
977 | action = new QAction( "import_ol", i18n("Import from OL"), 0, | 977 | action = new QAction( "import_ol", i18n("Import from OL"), 0, |
978 | this ); | 978 | this ); |
979 | action->addTo( importMenu_X ); | 979 | action->addTo( importMenu_X ); |
980 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); | 980 | connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); |
981 | #endif | 981 | #endif |
982 | //#endif | 982 | //#endif |
983 | 983 | ||
984 | //importMenu->insertSeparator(); | 984 | //importMenu->insertSeparator(); |
985 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, | 985 | action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, |
986 | this ); | 986 | this ); |
987 | action->addTo( importMenu ); | 987 | action->addTo( importMenu ); |
988 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); | 988 | connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); |
989 | 989 | ||
990 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, | 990 | action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, |
991 | this ); | 991 | this ); |
992 | action->addTo( importMenu ); | 992 | action->addTo( importMenu ); |
993 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); | 993 | connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); |
994 | importMenu->insertSeparator(); | 994 | importMenu->insertSeparator(); |
995 | importMenu->insertItem( i18n("Import"), importMenu_X ); | 995 | importMenu->insertItem( i18n("Import"), importMenu_X ); |
996 | //importMenu->insertSeparator(); | 996 | //importMenu->insertSeparator(); |
997 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, | 997 | action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, |
998 | this ); | 998 | this ); |
999 | action->addTo( exportMenu_X ); | 999 | action->addTo( exportMenu_X ); |
1000 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); | 1000 | connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); |
1001 | 1001 | ||
1002 | 1002 | ||
1003 | //LR | 1003 | //LR |
1004 | QPopupMenu *ex2phone = new QPopupMenu( this ); | 1004 | QPopupMenu *ex2phone = new QPopupMenu( this ); |
1005 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1005 | ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1006 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1006 | ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1007 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); | 1007 | connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); |
1008 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); | 1008 | exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); |
1009 | 1009 | ||
1010 | importMenu->insertItem( i18n("Export"), exportMenu_X ); | 1010 | importMenu->insertItem( i18n("Export"), exportMenu_X ); |
1011 | #ifndef DESKTOP_VERSION | 1011 | #ifndef DESKTOP_VERSION |
1012 | //importMenu->insertSeparator(); | 1012 | //importMenu->insertSeparator(); |
1013 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, | 1013 | brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, |
1014 | this ); | 1014 | this ); |
1015 | brAction->addTo( beamMenu_X ); | 1015 | brAction->addTo( beamMenu_X ); |
1016 | brAction->setToggleAction (true ) ; | 1016 | brAction->setToggleAction (true ) ; |
1017 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); | 1017 | connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); |
1018 | 1018 | ||
1019 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, | 1019 | action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, |
1020 | this ); | 1020 | this ); |
1021 | action->addTo( beamMenu_X ); | 1021 | action->addTo( beamMenu_X ); |
1022 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); | 1022 | connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); |
1023 | 1023 | ||
1024 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, | 1024 | action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, |
1025 | this ); | 1025 | this ); |
1026 | action->addTo( beamMenu_X ); | 1026 | action->addTo( beamMenu_X ); |
1027 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); | 1027 | connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); |
1028 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); | 1028 | importMenu->insertItem( i18n("Beam"), beamMenu_X ); |
1029 | #else | 1029 | #else |
1030 | //importMenu->insertSeparator(); | 1030 | //importMenu->insertSeparator(); |
1031 | icon = loadPixmap( pathString + "print" ); | 1031 | icon = loadPixmap( pathString + "print" ); |
1032 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); | 1032 | action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); |
1033 | action->addTo( beamMenu_X ); | 1033 | action->addTo( beamMenu_X ); |
1034 | connect( action, SIGNAL( activated() ), | 1034 | connect( action, SIGNAL( activated() ), |
1035 | this, SLOT( printCal() ) ); | 1035 | this, SLOT( printCal() ) ); |
1036 | 1036 | ||
1037 | icon = loadPixmap( pathString + "print" ); | 1037 | icon = loadPixmap( pathString + "print" ); |
1038 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); | 1038 | action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); |
1039 | action->addTo( beamMenu_X ); | 1039 | action->addTo( beamMenu_X ); |
1040 | connect( action, SIGNAL( activated() ), | 1040 | connect( action, SIGNAL( activated() ), |
1041 | this, SLOT( printSel() ) ); | 1041 | this, SLOT( printSel() ) ); |
1042 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); | 1042 | action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); |
1043 | action->addTo( beamMenu_X ); | 1043 | action->addTo( beamMenu_X ); |
1044 | connect( action, SIGNAL( activated() ), | 1044 | connect( action, SIGNAL( activated() ), |
1045 | mView->viewManager(), SLOT( slotprintWNV() ) ); | 1045 | mView->viewManager(), SLOT( slotprintWNV() ) ); |
1046 | 1046 | ||
1047 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); | 1047 | action = new QAction( i18n("Print selected event / todo..."),icon,i18n("Print selected event / todo..."), 0, this ); |
1048 | action->addTo( beamMenu_X ); | 1048 | action->addTo( beamMenu_X ); |
1049 | connect( action, SIGNAL( activated() ), | 1049 | connect( action, SIGNAL( activated() ), |
1050 | mView, SLOT( slotprintSelInc() ) ); | 1050 | mView, SLOT( slotprintSelInc() ) ); |
1051 | 1051 | ||
1052 | 1052 | ||
1053 | importMenu->insertItem( i18n("Print"), beamMenu_X ); | 1053 | importMenu->insertItem( i18n("Print"), beamMenu_X ); |
1054 | #endif | 1054 | #endif |
1055 | importMenu->insertSeparator(); | 1055 | importMenu->insertSeparator(); |
1056 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, | 1056 | action = new QAction( "manage cat", i18n("Manage new categories..."), 0, |
1057 | this ); | 1057 | this ); |
1058 | action->addTo( importMenu ); | 1058 | action->addTo( importMenu ); |
1059 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); | 1059 | connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); |
1060 | importMenu->insertSeparator(); | 1060 | importMenu->insertSeparator(); |
1061 | action = new QAction( "beam all", i18n("Save"), 0, | 1061 | action = new QAction( "beam all", i18n("Save"), 0, |
1062 | this ); | 1062 | this ); |
1063 | action->addTo( importMenu ); | 1063 | action->addTo( importMenu ); |
1064 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); | 1064 | connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); |
1065 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, | 1065 | action = new QAction( "beam all", i18n("Exit (+save)"), 0, |
1066 | this ); | 1066 | this ); |
1067 | action->addTo( importMenu ); | 1067 | action->addTo( importMenu ); |
1068 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); | 1068 | connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); |
1069 | 1069 | ||
1070 | //menuBar->insertItem( "Configure",configureMenu ); | 1070 | //menuBar->insertItem( "Configure",configureMenu ); |
1071 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); | 1071 | //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); |
1072 | icon = loadPixmap( "korganizer/korganizer" ); | 1072 | icon = loadPixmap( "korganizer/korganizer" ); |
1073 | 1073 | ||
1074 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); | 1074 | action = new QAction( "Whats New", i18n("What's new?"), 0,this ); |
1075 | action->addTo( helpMenu ); | 1075 | action->addTo( helpMenu ); |
1076 | connect( action, SIGNAL( activated() ), | 1076 | connect( action, SIGNAL( activated() ), |
1077 | SLOT( whatsNew() ) ); | 1077 | SLOT( whatsNew() ) ); |
1078 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); | 1078 | action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); |
1079 | action->addTo( helpMenu ); | 1079 | action->addTo( helpMenu ); |
1080 | connect( action, SIGNAL( activated() ), | 1080 | connect( action, SIGNAL( activated() ), |
1081 | SLOT( features() ) ); | 1081 | SLOT( features() ) ); |
1082 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); | 1082 | action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); |
1083 | action->addTo( helpMenu ); | 1083 | action->addTo( helpMenu ); |
1084 | connect( action, SIGNAL( activated() ), | 1084 | connect( action, SIGNAL( activated() ), |
1085 | SLOT( keyBindings() ) ); | 1085 | SLOT( keyBindings() ) ); |
1086 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); | 1086 | action = new QAction( "Storage Howto", i18n("Storage HowTo..."), 0,this ); |
1087 | action->addTo( helpMenu ); | 1087 | action->addTo( helpMenu ); |
1088 | connect( action, SIGNAL( activated() ), | 1088 | connect( action, SIGNAL( activated() ), |
1089 | SLOT( storagehowto() ) ); | 1089 | SLOT( storagehowto() ) ); |
1090 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); | 1090 | action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); |
1091 | action->addTo( helpMenu ); | 1091 | action->addTo( helpMenu ); |
1092 | connect( action, SIGNAL( activated() ), | 1092 | connect( action, SIGNAL( activated() ), |
1093 | SLOT( synchowto() ) ); | 1093 | SLOT( synchowto() ) ); |
1094 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); | 1094 | action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); |
1095 | action->addTo( helpMenu ); | 1095 | action->addTo( helpMenu ); |
1096 | connect( action, SIGNAL( activated() ), | 1096 | connect( action, SIGNAL( activated() ), |
1097 | SLOT( kdesynchowto() ) ); | 1097 | SLOT( kdesynchowto() ) ); |
1098 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); | 1098 | action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); |
1099 | action->addTo( helpMenu ); | 1099 | action->addTo( helpMenu ); |
1100 | connect( action, SIGNAL( activated() ), | 1100 | connect( action, SIGNAL( activated() ), |
1101 | SLOT( multisynchowto() ) ); | 1101 | SLOT( multisynchowto() ) ); |
1102 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); | 1102 | action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); |
1103 | action->addTo( helpMenu ); | 1103 | action->addTo( helpMenu ); |
1104 | connect( action, SIGNAL( activated() ), | 1104 | connect( action, SIGNAL( activated() ), |
1105 | SLOT( aboutAutoSaving() ) ); | 1105 | SLOT( aboutAutoSaving() ) ); |
1106 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); | 1106 | action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); |
1107 | action->addTo( helpMenu ); | 1107 | action->addTo( helpMenu ); |
1108 | connect( action, SIGNAL( activated() ), | 1108 | connect( action, SIGNAL( activated() ), |
1109 | SLOT( aboutKnownBugs() ) ); | 1109 | SLOT( aboutKnownBugs() ) ); |
1110 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); | 1110 | action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); |
1111 | action->addTo( helpMenu ); | 1111 | action->addTo( helpMenu ); |
1112 | connect( action, SIGNAL( activated() ), | 1112 | connect( action, SIGNAL( activated() ), |
1113 | SLOT( usertrans() ) ); | 1113 | SLOT( usertrans() ) ); |
1114 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); | 1114 | action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); |
1115 | action->addTo( helpMenu ); | 1115 | action->addTo( helpMenu ); |
1116 | connect( action, SIGNAL( activated() ), | 1116 | connect( action, SIGNAL( activated() ), |
1117 | SLOT( faq() ) ); | 1117 | SLOT( faq() ) ); |
1118 | action = new QAction( "licence", i18n("Licence..."), 0, this ); | 1118 | action = new QAction( "licence", i18n("Licence..."), 0, this ); |
1119 | action->addTo( helpMenu ); | 1119 | action->addTo( helpMenu ); |
1120 | connect( action, SIGNAL( activated() ), | 1120 | connect( action, SIGNAL( activated() ), |
1121 | SLOT( licence() ) ); | 1121 | SLOT( licence() ) ); |
1122 | action = new QAction( "about", i18n("About..."), 0, this ); | 1122 | action = new QAction( "about", i18n("About..."), 0, this ); |
1123 | action->addTo( helpMenu ); | 1123 | action->addTo( helpMenu ); |
1124 | connect( action, SIGNAL( activated() ), | 1124 | connect( action, SIGNAL( activated() ), |
1125 | SLOT( about() ) ); | 1125 | SLOT( about() ) ); |
1126 | //menuBar->insertSeparator(); | 1126 | //menuBar->insertSeparator(); |
1127 | 1127 | ||
1128 | // ****************************************************** | 1128 | // ****************************************************** |
1129 | // menubar icons | 1129 | // menubar icons |
1130 | 1130 | ||
1131 | 1131 | ||
1132 | 1132 | ||
1133 | //menuBar->insertItem( iconToolBar ); | 1133 | //menuBar->insertItem( iconToolBar ); |
1134 | //xdays_action | 1134 | //xdays_action |
1135 | if (p-> mShowIconNewEvent) | 1135 | if (p-> mShowIconNewEvent) |
1136 | ne_action->addTo( iconToolBar ); | 1136 | ne_action->addTo( iconToolBar ); |
1137 | if (p->mShowIconNewTodo ) | 1137 | if (p->mShowIconNewTodo ) |
1138 | nt_action->addTo( iconToolBar ); | 1138 | nt_action->addTo( iconToolBar ); |
1139 | if (p-> mShowIconSearch) | 1139 | if (p-> mShowIconSearch) |
1140 | search_action->addTo( iconToolBar ); | 1140 | search_action->addTo( iconToolBar ); |
1141 | if (p-> mShowIconWhatsThis) | 1141 | if (p-> mShowIconWhatsThis) |
1142 | QWhatsThis::whatsThisButton ( iconToolBar ); | 1142 | QWhatsThis::whatsThisButton ( iconToolBar ); |
1143 | if (p-> mShowIconNext) | 1143 | if (p-> mShowIconNext) |
1144 | whatsnext_action->addTo( viewToolBar ); | 1144 | whatsnext_action->addTo( viewToolBar ); |
1145 | if (p-> mShowIconNextDays) | 1145 | if (p-> mShowIconNextDays) |
1146 | xdays_action->addTo( viewToolBar ); | 1146 | xdays_action->addTo( viewToolBar ); |
1147 | if (p-> mShowIconJournal) | 1147 | if (p-> mShowIconJournal) |
1148 | viewjournal_action->addTo( viewToolBar ); | 1148 | viewjournal_action->addTo( viewToolBar ); |
1149 | if (p-> mShowIconDay1) | 1149 | if (p-> mShowIconDay1) |
1150 | day1_action->addTo( viewToolBar ); | 1150 | day1_action->addTo( viewToolBar ); |
1151 | if (p-> mShowIconDay5) | 1151 | if (p-> mShowIconDay5) |
1152 | day5_action->addTo( viewToolBar ); | 1152 | day5_action->addTo( viewToolBar ); |
1153 | if (p-> mShowIconDay7) | 1153 | if (p-> mShowIconDay7) |
1154 | day7_action->addTo( viewToolBar ); | 1154 | day7_action->addTo( viewToolBar ); |
1155 | if (p-> mShowIconDay6) | 1155 | if (p-> mShowIconDay6) |
1156 | day6_action->addTo( viewToolBar ); | 1156 | day6_action->addTo( viewToolBar ); |
1157 | if (p-> mShowIconMonth) | 1157 | if (p-> mShowIconMonth) |
1158 | month_action->addTo( viewToolBar ); | 1158 | month_action->addTo( viewToolBar ); |
1159 | if (p-> mShowIconList) | 1159 | if (p-> mShowIconList) |
1160 | showlist_action->addTo( viewToolBar ); | 1160 | showlist_action->addTo( viewToolBar ); |
1161 | if (p-> mShowIconTodoview) | 1161 | if (p-> mShowIconTodoview) |
1162 | todoview_action->addTo( viewToolBar ); | 1162 | todoview_action->addTo( viewToolBar ); |
1163 | 1163 | ||
1164 | icon = loadPixmap( pathString + "2leftarrowB" ); | 1164 | icon = loadPixmap( pathString + "2leftarrowB" ); |
1165 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); | 1165 | configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200); |
1166 | if (p-> mShowIconBackFast) { | 1166 | if (p-> mShowIconBackFast) { |
1167 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); | 1167 | action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); |
1168 | connect( action, SIGNAL( activated() ), | 1168 | connect( action, SIGNAL( activated() ), |
1169 | mView, SLOT( goPreviousMonth() ) ); | 1169 | mView, SLOT( goPreviousMonth() ) ); |
1170 | action->addTo( navigatorToolBar ); | 1170 | action->addTo( navigatorToolBar ); |
1171 | } | 1171 | } |
1172 | icon = loadPixmap( pathString + "1leftarrowB" ); | 1172 | icon = loadPixmap( pathString + "1leftarrowB" ); |
1173 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); | 1173 | configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210); |
1174 | if (p-> mShowIconBack) { | 1174 | if (p-> mShowIconBack) { |
1175 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); | 1175 | action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); |
1176 | connect( action, SIGNAL( activated() ), | 1176 | connect( action, SIGNAL( activated() ), |
1177 | mView, SLOT( goPrevious() ) ); | 1177 | mView, SLOT( goPrevious() ) ); |
1178 | action->addTo( navigatorToolBar ); | 1178 | action->addTo( navigatorToolBar ); |
1179 | } | 1179 | } |
1180 | icon = loadPixmap( pathString + "today" ); | 1180 | icon = loadPixmap( pathString + "today" ); |
1181 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); | 1181 | configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); |
1182 | if (p-> mShowIconToday) | 1182 | if (p-> mShowIconToday) |
1183 | today_action->addTo( navigatorToolBar ); | 1183 | today_action->addTo( navigatorToolBar ); |
1184 | icon = loadPixmap( pathString + "1rightarrowB" ); | 1184 | icon = loadPixmap( pathString + "1rightarrowB" ); |
1185 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); | 1185 | configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); |
1186 | if (p-> mShowIconForward) { | 1186 | if (p-> mShowIconForward) { |
1187 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); | 1187 | action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); |
1188 | connect( action, SIGNAL( activated() ), | 1188 | connect( action, SIGNAL( activated() ), |
1189 | mView, SLOT( goNext() ) ); | 1189 | mView, SLOT( goNext() ) ); |
1190 | action->addTo( navigatorToolBar ); | 1190 | action->addTo( navigatorToolBar ); |
1191 | } | 1191 | } |
1192 | icon = loadPixmap( pathString + "2rightarrowB" ); | 1192 | icon = loadPixmap( pathString + "2rightarrowB" ); |
1193 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); | 1193 | configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); |
1194 | if (p-> mShowIconForwardFast) { | 1194 | if (p-> mShowIconForwardFast) { |
1195 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); | 1195 | action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); |
1196 | connect( action, SIGNAL( activated() ), | 1196 | connect( action, SIGNAL( activated() ), |
1197 | mView, SLOT( goNextMonth() ) ); | 1197 | mView, SLOT( goNextMonth() ) ); |
1198 | action->addTo( navigatorToolBar ); | 1198 | action->addTo( navigatorToolBar ); |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | 1201 | ||
1202 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); | 1202 | configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6); |
1203 | 1203 | ||
1204 | 1204 | ||
1205 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); | 1205 | if ( p->mShowIconNavigator ) configureToolBarMenu->setItemChecked( 22 , true); |
1206 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); | 1206 | if ( p->mShowIconAllday ) configureToolBarMenu->setItemChecked( 24 , true); |
1207 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); | 1207 | if ( p->mShowIconFilterview ) configureToolBarMenu->setItemChecked( 26 , true); |
1208 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); | 1208 | if ( p->mShowIconToggleFull ) configureToolBarMenu->setItemChecked( 28 , true); |
1209 | 1209 | ||
1210 | if (p-> mShowIconNewEvent) | 1210 | if (p-> mShowIconNewEvent) |
1211 | configureToolBarMenu->setItemChecked( 10, true ); | 1211 | configureToolBarMenu->setItemChecked( 10, true ); |
1212 | if (p->mShowIconNewTodo ) | 1212 | if (p->mShowIconNewTodo ) |
1213 | configureToolBarMenu->setItemChecked( 20, true ); | 1213 | configureToolBarMenu->setItemChecked( 20, true ); |
1214 | if (p-> mShowIconSearch) | 1214 | if (p-> mShowIconSearch) |
1215 | configureToolBarMenu->setItemChecked( 120, true ); | 1215 | configureToolBarMenu->setItemChecked( 120, true ); |
1216 | if (p-> mShowIconList) | 1216 | if (p-> mShowIconList) |
1217 | configureToolBarMenu->setItemChecked( 30, true ); | 1217 | configureToolBarMenu->setItemChecked( 30, true ); |
1218 | if (p-> mShowIconDay1) | 1218 | if (p-> mShowIconDay1) |
1219 | configureToolBarMenu->setItemChecked( 40, true ); | 1219 | configureToolBarMenu->setItemChecked( 40, true ); |
1220 | if (p-> mShowIconDay5) | 1220 | if (p-> mShowIconDay5) |
1221 | configureToolBarMenu->setItemChecked( 50, true ); | 1221 | configureToolBarMenu->setItemChecked( 50, true ); |
1222 | if (p-> mShowIconDay6) | 1222 | if (p-> mShowIconDay6) |
1223 | configureToolBarMenu->setItemChecked( 75, true ); | 1223 | configureToolBarMenu->setItemChecked( 75, true ); |
1224 | if (p-> mShowIconDay7) | 1224 | if (p-> mShowIconDay7) |
1225 | configureToolBarMenu->setItemChecked( 60, true ); | 1225 | configureToolBarMenu->setItemChecked( 60, true ); |
1226 | if (p-> mShowIconMonth) | 1226 | if (p-> mShowIconMonth) |
1227 | configureToolBarMenu->setItemChecked( 70, true ); | 1227 | configureToolBarMenu->setItemChecked( 70, true ); |
1228 | if (p-> mShowIconTodoview) | 1228 | if (p-> mShowIconTodoview) |
1229 | configureToolBarMenu->setItemChecked( 80, true ); | 1229 | configureToolBarMenu->setItemChecked( 80, true ); |
1230 | if (p-> mShowIconBackFast) | 1230 | if (p-> mShowIconBackFast) |
1231 | configureToolBarMenu->setItemChecked( 200, true ); | 1231 | configureToolBarMenu->setItemChecked( 200, true ); |
1232 | if (p-> mShowIconBack) | 1232 | if (p-> mShowIconBack) |
1233 | configureToolBarMenu->setItemChecked( 210, true ); | 1233 | configureToolBarMenu->setItemChecked( 210, true ); |
1234 | if (p-> mShowIconToday) | 1234 | if (p-> mShowIconToday) |
1235 | configureToolBarMenu->setItemChecked( 130, true ); | 1235 | configureToolBarMenu->setItemChecked( 130, true ); |
1236 | if (p-> mShowIconForward) | 1236 | if (p-> mShowIconForward) |
1237 | configureToolBarMenu->setItemChecked( 220, true ); | 1237 | configureToolBarMenu->setItemChecked( 220, true ); |
1238 | if (p-> mShowIconForwardFast) | 1238 | if (p-> mShowIconForwardFast) |
1239 | configureToolBarMenu->setItemChecked( 230, true ); | 1239 | configureToolBarMenu->setItemChecked( 230, true ); |
1240 | if (p-> mShowIconNextDays) | 1240 | if (p-> mShowIconNextDays) |
1241 | configureToolBarMenu->setItemChecked( 100, true ); | 1241 | configureToolBarMenu->setItemChecked( 100, true ); |
1242 | if (p-> mShowIconNext) | 1242 | if (p-> mShowIconNext) |
1243 | configureToolBarMenu->setItemChecked( 110, true ); | 1243 | configureToolBarMenu->setItemChecked( 110, true ); |
1244 | if (p-> mShowIconJournal) | 1244 | if (p-> mShowIconJournal) |
1245 | configureToolBarMenu->setItemChecked( 90, true ); | 1245 | configureToolBarMenu->setItemChecked( 90, true ); |
1246 | if (p-> mShowIconWhatsThis) | 1246 | if (p-> mShowIconWhatsThis) |
1247 | configureToolBarMenu->setItemChecked( 300, true ); | 1247 | configureToolBarMenu->setItemChecked( 300, true ); |
1248 | if (p-> mShowIconWeekNum) | 1248 | if (p-> mShowIconWeekNum) |
1249 | configureToolBarMenu->setItemChecked( 400, true ); | 1249 | configureToolBarMenu->setItemChecked( 400, true ); |
1250 | if (!p-> mShowIconStretch) { | 1250 | if (!p-> mShowIconStretch) { |
1251 | QLabel* dummy = new QLabel( iconToolBar ); | 1251 | QLabel* dummy = new QLabel( iconToolBar ); |
1252 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); | 1252 | dummy->setBackgroundColor( iconToolBar->backgroundColor() ); |
1253 | dummy->setMinimumWidth( 0 ); | 1253 | dummy->setMinimumWidth( 0 ); |
1254 | iconToolBar->setStretchableWidget ( dummy ) ; | 1254 | iconToolBar->setStretchableWidget ( dummy ) ; |
1255 | } | 1255 | } |
1256 | else { | 1256 | else { |
1257 | iconToolBar->setHorizontalStretchable (true ); | 1257 | iconToolBar->setHorizontalStretchable (true ); |
1258 | viewToolBar->setHorizontalStretchable (true ); | 1258 | viewToolBar->setHorizontalStretchable (true ); |
1259 | navigatorToolBar->setHorizontalStretchable (true ); | 1259 | navigatorToolBar->setHorizontalStretchable (true ); |
1260 | iconToolBar->setVerticalStretchable (true ); | 1260 | iconToolBar->setVerticalStretchable (true ); |
1261 | viewToolBar->setVerticalStretchable (true ); | 1261 | viewToolBar->setVerticalStretchable (true ); |
1262 | navigatorToolBar->setVerticalStretchable (true ); | 1262 | navigatorToolBar->setVerticalStretchable (true ); |
1263 | configureToolBarMenu->setItemChecked( 5, true ); | 1263 | configureToolBarMenu->setItemChecked( 5, true ); |
1264 | } | 1264 | } |
1265 | if (p-> mShowIconFilter) | 1265 | if (p-> mShowIconFilter) |
1266 | configureToolBarMenu->setItemChecked( 7, true ); | 1266 | configureToolBarMenu->setItemChecked( 7, true ); |
1267 | if (p-> mShowIconOnetoolbar) | 1267 | if (p-> mShowIconOnetoolbar) |
1268 | configureToolBarMenu->setItemChecked( 6, true ); | 1268 | configureToolBarMenu->setItemChecked( 6, true ); |
1269 | 1269 | ||
1270 | 1270 | ||
1271 | if ( filterMenubar ) | 1271 | if ( filterMenubar ) |
1272 | connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); | 1272 | connect( mView->filterView(), SIGNAL( filterChanged() ), SLOT( updateFilterToolbar() ) ); |
1273 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); | 1273 | connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); |
1274 | configureAgenda( p->mHourSize ); | 1274 | configureAgenda( p->mHourSize ); |
1275 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); | 1275 | connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); |
1276 | } | 1276 | } |
1277 | 1277 | ||
1278 | void MainWindow::exportToPhone( int mode ) | 1278 | void MainWindow::exportToPhone( int mode ) |
1279 | { | 1279 | { |
1280 | 1280 | ||
1281 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); | 1281 | //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); |
1282 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); | 1282 | //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); |
1283 | KOex2phonePrefs ex2phone; | 1283 | KOex2phonePrefs ex2phone; |
1284 | 1284 | ||
1285 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); | 1285 | ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); |
1286 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); | 1286 | ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); |
1287 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1287 | ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1288 | if ( mode == 1 ) | 1288 | if ( mode == 1 ) |
1289 | ex2phone.setCaption(i18n("Export complete calendar")); | 1289 | ex2phone.setCaption(i18n("Export complete calendar")); |
1290 | if ( mode == 2 ) | 1290 | if ( mode == 2 ) |
1291 | ex2phone.setCaption(i18n("Export filtered calendar")); | 1291 | ex2phone.setCaption(i18n("Export filtered calendar")); |
1292 | 1292 | ||
1293 | if ( !ex2phone.exec() ) { | 1293 | if ( !ex2phone.exec() ) { |
1294 | return; | 1294 | return; |
1295 | } | 1295 | } |
1296 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); | 1296 | KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); |
1297 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); | 1297 | KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); |
1298 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); | 1298 | KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); |
1299 | 1299 | ||
1300 | int inFuture = 0; | 1300 | int inFuture = 0; |
1301 | if ( ex2phone.mWriteBackFuture->isChecked() ) | 1301 | if ( ex2phone.mWriteBackFuture->isChecked() ) |
1302 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); | 1302 | inFuture = ex2phone.mWriteBackFutureWeeks->value(); |
1303 | QPtrList<Incidence> delSel; | 1303 | QPtrList<Incidence> delSel; |
1304 | if ( mode == 1 ) | 1304 | if ( mode == 1 ) |
1305 | delSel = mCalendar->rawIncidences(); | 1305 | delSel = mCalendar->rawIncidences(); |
1306 | if ( mode == 2 ) | 1306 | if ( mode == 2 ) |
1307 | delSel = mCalendar->incidences(); | 1307 | delSel = mCalendar->incidences(); |
1308 | CalendarLocal* cal = new CalendarLocal(); | 1308 | CalendarLocal* cal = new CalendarLocal(); |
1309 | cal->setLocalTime(); | 1309 | cal->setLocalTime(); |
1310 | Incidence *incidence = delSel.first(); | 1310 | Incidence *incidence = delSel.first(); |
1311 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); | 1311 | QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); |
1312 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); | 1312 | QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); |
1313 | while ( incidence ) { | 1313 | while ( incidence ) { |
1314 | if ( incidence->type() != "Journal" ) { | 1314 | if ( incidence->type() != "Journal" ) { |
1315 | bool add = true; | 1315 | bool add = true; |
1316 | if ( inFuture ) { | 1316 | if ( inFuture ) { |
1317 | QDateTime dt; | 1317 | QDateTime dt; |
1318 | if ( incidence->type() == "Todo" ) { | 1318 | if ( incidence->type() == "Todo" ) { |
1319 | Todo * t = (Todo*)incidence; | 1319 | Todo * t = (Todo*)incidence; |
1320 | if ( t->hasDueDate() ) | 1320 | if ( t->hasDueDate() ) |
1321 | dt = t->dtDue(); | 1321 | dt = t->dtDue(); |
1322 | else | 1322 | else |
1323 | dt = cur.addSecs( 62 ); | 1323 | dt = cur.addSecs( 62 ); |
1324 | } | 1324 | } |
1325 | else { | 1325 | else { |
1326 | bool ok; | 1326 | bool ok; |
1327 | dt = incidence->getNextOccurence( cur, &ok ); | 1327 | dt = incidence->getNextOccurence( cur, &ok ); |
1328 | if ( !ok ) | 1328 | if ( !ok ) |
1329 | dt = cur.addSecs( -62 ); | 1329 | dt = cur.addSecs( -62 ); |
1330 | } | 1330 | } |
1331 | if ( dt < cur || dt > end ) { | 1331 | if ( dt < cur || dt > end ) { |
1332 | add = false; | 1332 | add = false; |
1333 | } | 1333 | } |
1334 | } | 1334 | } |
1335 | if ( add ) { | 1335 | if ( add ) { |
1336 | Incidence *in = incidence->clone(); | 1336 | Incidence *in = incidence->clone(); |
1337 | cal->addIncidence( in ); | 1337 | cal->addIncidence( in ); |
1338 | } | 1338 | } |
1339 | } | 1339 | } |
1340 | incidence = delSel.next(); | 1340 | incidence = delSel.next(); |
1341 | } | 1341 | } |
1342 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, | 1342 | PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, |
1343 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, | 1343 | KPimGlobalPrefs::instance()->mEx2PhoneConnection, |
1344 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); | 1344 | KPimGlobalPrefs::instance()->mEx2PhoneModel ); |
1345 | 1345 | ||
1346 | setCaption( i18n("Writing to phone...")); | 1346 | setCaption( i18n("Writing to phone...")); |
1347 | if ( PhoneFormat::writeToPhone( cal ) ) | 1347 | if ( PhoneFormat::writeToPhone( cal ) ) |
1348 | setCaption( i18n("Export to phone successful!")); | 1348 | setCaption( i18n("Export to phone successful!")); |
1349 | else | 1349 | else |
1350 | setCaption( i18n("Error exporting to phone!")); | 1350 | setCaption( i18n("Error exporting to phone!")); |
1351 | delete cal; | 1351 | delete cal; |
1352 | } | 1352 | } |
1353 | 1353 | ||
1354 | 1354 | ||
1355 | void MainWindow::setDefaultPreferences() | 1355 | void MainWindow::setDefaultPreferences() |
1356 | { | 1356 | { |
1357 | KOPrefs *p = KOPrefs::instance(); | 1357 | KOPrefs *p = KOPrefs::instance(); |
1358 | 1358 | ||
1359 | p->mCompactDialogs = true; | 1359 | p->mCompactDialogs = true; |
1360 | p->mConfirm = true; | 1360 | p->mConfirm = true; |
1361 | // p->mEnableQuickTodo = false; | 1361 | // p->mEnableQuickTodo = false; |
1362 | 1362 | ||
1363 | } | 1363 | } |
1364 | 1364 | ||
1365 | QString MainWindow::resourcePath() | 1365 | QString MainWindow::resourcePath() |
1366 | { | 1366 | { |
1367 | return KGlobal::iconLoader()->iconPath(); | 1367 | return KGlobal::iconLoader()->iconPath(); |
1368 | } | 1368 | } |
1369 | 1369 | ||
1370 | void MainWindow::displayText( QString text ,QString cap ) | 1370 | void MainWindow::displayText( QString text ,QString cap ) |
1371 | { | 1371 | { |
1372 | QDialog dia( this, "name", true ); ; | 1372 | QDialog dia( this, "name", true ); ; |
1373 | dia.setCaption( cap ); | 1373 | dia.setCaption( cap ); |
1374 | QVBoxLayout* lay = new QVBoxLayout( &dia ); | 1374 | QVBoxLayout* lay = new QVBoxLayout( &dia ); |
1375 | lay->setSpacing( 3 ); | 1375 | lay->setSpacing( 3 ); |
1376 | lay->setMargin( 3 ); | 1376 | lay->setMargin( 3 ); |
1377 | QTextBrowser tb ( &dia ); | 1377 | QTextBrowser tb ( &dia ); |
1378 | lay->addWidget( &tb ); | 1378 | lay->addWidget( &tb ); |
1379 | tb.setText( text ); | 1379 | tb.setText( text ); |
1380 | #ifdef DESKTOP_VERSION | 1380 | #ifdef DESKTOP_VERSION |
1381 | dia.resize( 640, 480); | 1381 | dia.resize( 640, 480); |
1382 | #else | 1382 | #else |
1383 | dia.showMaximized(); | 1383 | dia.showMaximized(); |
1384 | #endif | 1384 | #endif |
1385 | dia.exec(); | 1385 | dia.exec(); |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | void MainWindow::features() | 1388 | void MainWindow::features() |
1389 | { | 1389 | { |
1390 | 1390 | ||
1391 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); | 1391 | KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); |
1392 | } | 1392 | } |
1393 | 1393 | ||
1394 | void MainWindow::usertrans() | 1394 | void MainWindow::usertrans() |
1395 | { | 1395 | { |
1396 | 1396 | ||
1397 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); | 1397 | KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); |
1398 | } | 1398 | } |
1399 | 1399 | ||
1400 | void MainWindow::storagehowto() | 1400 | void MainWindow::storagehowto() |
1401 | { | 1401 | { |
1402 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); | 1402 | KApplication::showFile( "KDE-Pim/Pi Storage HowTo", "kdepim/storagehowto.txt" ); |
1403 | } | 1403 | } |
1404 | void MainWindow::kdesynchowto() | 1404 | void MainWindow::kdesynchowto() |
1405 | { | 1405 | { |
1406 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); | 1406 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); |
1407 | } | 1407 | } |
1408 | void MainWindow::multisynchowto() | 1408 | void MainWindow::multisynchowto() |
1409 | { | 1409 | { |
1410 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); | 1410 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); |
1411 | } | 1411 | } |
1412 | void MainWindow::synchowto() | 1412 | void MainWindow::synchowto() |
1413 | { | 1413 | { |
1414 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); | 1414 | KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); |
1415 | } | 1415 | } |
1416 | void MainWindow::faq() | 1416 | void MainWindow::faq() |
1417 | { | 1417 | { |
1418 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); | 1418 | KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); |
1419 | 1419 | ||
1420 | } | 1420 | } |
1421 | void MainWindow::whatsNew() | 1421 | void MainWindow::whatsNew() |
1422 | { | 1422 | { |
1423 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); | 1423 | KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); |
1424 | 1424 | ||
1425 | } | 1425 | } |
1426 | void MainWindow::licence() | 1426 | void MainWindow::licence() |
1427 | { | 1427 | { |
1428 | KApplication::showLicence(); | 1428 | KApplication::showLicence(); |
1429 | 1429 | ||
1430 | } | 1430 | } |
1431 | void MainWindow::about() | 1431 | void MainWindow::about() |
1432 | { | 1432 | { |
1433 | QString version; | 1433 | QString version; |
1434 | #include <../version> | 1434 | #include <../version> |
1435 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), | 1435 | QMessageBox::about( this, i18n("About KOrganizer/Pi"), |
1436 | i18n("KOrganizer/Platform-independent\n") + | 1436 | i18n("KOrganizer/Platform-independent\n") + |
1437 | "(KO/Pi) " + version + " - " + | 1437 | "(KO/Pi) " + version + " - " + |
1438 | 1438 | ||
1439 | #ifdef DESKTOP_VERSION | 1439 | #ifdef DESKTOP_VERSION |
1440 | i18n("Desktop Edition\n") + | 1440 | i18n("Desktop Edition\n") + |
1441 | #else | 1441 | #else |
1442 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + | 1442 | i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + |
1443 | #endif | 1443 | #endif |
1444 | 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.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); | 1444 | 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.info --- www.korganizer.org\nSpecial thanks to Michael and Ben\nfor intensive testing!") ); |
1445 | } | 1445 | } |
1446 | void MainWindow::keyBindings() | 1446 | void MainWindow::keyBindings() |
1447 | { | 1447 | { |
1448 | QString cap = i18n("KO/Pi Keys + Colors"); | 1448 | QString cap = i18n("KO/Pi Keys + Colors"); |
1449 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + | 1449 | QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + |
1450 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ | 1450 | i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ |
1451 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + | 1451 | i18n("<p><b>N</b>: Switch to next view which has a toolbar icon</p>\n") + |
1452 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + | 1452 | i18n("<p><b>A+(shift or ctrl)</b>: Show occurence of next alarm</p>\n") + |
1453 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + | 1453 | i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + |
1454 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ | 1454 | i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ |
1455 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ | 1455 | i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ |
1456 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ | 1456 | i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ |
1457 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ | 1457 | i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ |
1458 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ | 1458 | i18n("<p><b>X</b>: Next X days view| <b>W</b>: What's next view\n ")+ |
1459 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ | 1459 | i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ |
1460 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ | 1460 | i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ |
1461 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ | 1461 | i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ |
1462 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ | 1462 | i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ |
1463 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ | 1463 | i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ |
1464 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ | 1464 | i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ |
1465 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ | 1465 | i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X+ctrl</b>: Toggle datenavigator</p>\n")+ |
1466 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ | 1466 | i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ |
1467 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ | 1467 | i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ |
1468 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ | 1468 | i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ |
1469 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ | 1469 | i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ |
1470 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ | 1470 | i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ |
1471 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ | 1471 | i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ |
1472 | i18n("<p><h3>In agenda view:</h3></p>\n") + | 1472 | i18n("<p><h3>In agenda view:</h3></p>\n") + |
1473 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ | 1473 | i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ |
1474 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ | 1474 | i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ |
1475 | i18n("<p><h3>In todo view:</h3></p>\n") + | 1475 | i18n("<p><h3>In todo view:</h3></p>\n") + |
1476 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ | 1476 | i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ |
1477 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ | 1477 | i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ |
1478 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ | 1478 | i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ |
1479 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ | 1479 | i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ |
1480 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1480 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1481 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ | 1481 | i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ |
1482 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ | 1482 | i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ |
1483 | i18n("<p><h3>In list view:</h3></p>\n") + | 1483 | i18n("<p><h3>In list view:</h3></p>\n") + |
1484 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ | 1484 | i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ |
1485 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ | 1485 | i18n("<p><b>return</b>: Select item+one step down</p>\n")+ |
1486 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ | 1486 | i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ |
1487 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ | 1487 | i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ |
1488 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ | 1488 | i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ |
1489 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ | 1489 | i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ |
1490 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + | 1490 | i18n("<p><h3>In event/todo viewer:</h3></p>\n") + |
1491 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ | 1491 | i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ |
1492 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ | 1492 | i18n("<p><b>A</b>: Show agenda view.</p>\n")+ |
1493 | i18n("<p><b>E</b>: Edit item</p>\n") + | 1493 | i18n("<p><b>E</b>: Edit item</p>\n") + |
1494 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + | 1494 | i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + |
1495 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + | 1495 | i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + |
1496 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ | 1496 | i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ |
1497 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ | 1497 | i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ |
1498 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ | 1498 | i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ |
1499 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ | 1499 | i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ |
1500 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ | 1500 | i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ |
1501 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + | 1501 | i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + |
1502 | i18n("<p><b>White</b>: Item readonly</p>\n"); | 1502 | i18n("<p><b>White</b>: Item readonly</p>\n"); |
1503 | displayText( text, cap); | 1503 | displayText( text, cap); |
1504 | } | 1504 | } |
1505 | void MainWindow::aboutAutoSaving() | 1505 | void MainWindow::aboutAutoSaving() |
1506 | { | 1506 | { |
1507 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); | 1507 | QString text = i18n("After changing something, the data is\nautomatically saved to the file\n~/kdepim/apps/korganizer/mycalendar.ics\nafter (configurable) three minutes.\nFor safety reasons there is one autosaving\nafter 10 minutes (of idle time) again. The \ndata is saved automatically when closing KO/Pi\nYou can create a backup file \nwith: File - Save Calendar Backup\n"); |
1508 | 1508 | ||
1509 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); | 1509 | KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); |
1510 | 1510 | ||
1511 | } | 1511 | } |
1512 | void MainWindow::aboutKnownBugs() | 1512 | void MainWindow::aboutKnownBugs() |
1513 | { | 1513 | { |
1514 | QMessageBox* msg; | 1514 | QMessageBox* msg; |
1515 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), | 1515 | msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), |
1516 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ | 1516 | i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ |
1517 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ | 1517 | i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ |
1518 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + | 1518 | i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + |
1519 | i18n("\nor report them in the bugtracker on\n") + | 1519 | i18n("\nor report them in the bugtracker on\n") + |
1520 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), | 1520 | i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), |
1521 | QMessageBox::NoIcon, | 1521 | QMessageBox::NoIcon, |
1522 | QMessageBox::Ok, | 1522 | QMessageBox::Ok, |
1523 | QMessageBox::NoButton, | 1523 | QMessageBox::NoButton, |
1524 | QMessageBox::NoButton); | 1524 | QMessageBox::NoButton); |
1525 | msg->exec(); | 1525 | msg->exec(); |
1526 | delete msg; | 1526 | delete msg; |
1527 | 1527 | ||
1528 | } | 1528 | } |
1529 | 1529 | ||
1530 | QString MainWindow::defaultFileName() | 1530 | QString MainWindow::defaultFileName() |
1531 | { | 1531 | { |
1532 | return locateLocal( "data", "korganizer/mycalendar.ics" ); | 1532 | return locateLocal( "data", "korganizer/mycalendar.ics" ); |
1533 | } | 1533 | } |
1534 | QString MainWindow::syncFileName() | 1534 | QString MainWindow::syncFileName() |
1535 | { | 1535 | { |
1536 | #ifdef DESKTOP_VERSION | 1536 | #ifdef DESKTOP_VERSION |
1537 | return locateLocal( "tmp", "synccalendar.ics" ); | 1537 | return locateLocal( "tmp", "synccalendar.ics" ); |
1538 | #else | 1538 | #else |
1539 | return QString( "/tmp/synccalendar.ics" ); | 1539 | return QString( "/tmp/synccalendar.ics" ); |
1540 | #endif | 1540 | #endif |
1541 | } | 1541 | } |
1542 | #include "koglobals.h" | 1542 | #include "koglobals.h" |
1543 | #include <kcalendarsystem.h> | 1543 | #include <kcalendarsystem.h> |
1544 | void MainWindow::updateWeek(QDate seda) | 1544 | void MainWindow::updateWeek(QDate seda) |
1545 | { | 1545 | { |
1546 | int weekNum = KGlobal::locale()->weekNum ( seda ); | 1546 | int weekNum = KGlobal::locale()->weekNum ( seda ); |
1547 | mWeekPixmap.fill( mWeekBgColor ); | 1547 | mWeekPixmap.fill( mWeekBgColor ); |
1548 | QPainter p ( &mWeekPixmap ); | 1548 | QPainter p ( &mWeekPixmap ); |
1549 | p.setFont( mWeekFont ); | 1549 | p.setFont( mWeekFont ); |
1550 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); | 1550 | p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); |
1551 | p.end(); | 1551 | p.end(); |
1552 | QIconSet icon3 ( mWeekPixmap ); | 1552 | QIconSet icon3 ( mWeekPixmap ); |
1553 | mWeekAction->setIconSet ( icon3 ); | 1553 | mWeekAction->setIconSet ( icon3 ); |
1554 | 1554 | ||
1555 | } | 1555 | } |
1556 | void MainWindow::updateWeekNum(const DateList &selectedDates) | 1556 | void MainWindow::updateWeekNum(const DateList &selectedDates) |
1557 | { | 1557 | { |
1558 | updateWeek( selectedDates.first() ); | 1558 | updateWeek( selectedDates.first() ); |
1559 | } | 1559 | } |
1560 | void MainWindow::processIncidenceSelection( Incidence *incidence ) | 1560 | void MainWindow::processIncidenceSelection( Incidence *incidence ) |
1561 | { | 1561 | { |
1562 | 1562 | ||
1563 | if ( !incidence ) { | 1563 | if ( !incidence ) { |
1564 | enableIncidenceActions( false ); | 1564 | enableIncidenceActions( false ); |
1565 | 1565 | ||
1566 | mNewSubTodoAction->setEnabled( false ); | 1566 | mNewSubTodoAction->setEnabled( false ); |
1567 | setCaptionToDates(); | 1567 | setCaptionToDates(); |
1568 | return; | 1568 | return; |
1569 | 1569 | ||
1570 | } | 1570 | } |
1571 | 1571 | ||
1572 | //KGlobal::locale()->formatDateTime(nextA, true); | 1572 | //KGlobal::locale()->formatDateTime(nextA, true); |
1573 | QString startString = ""; | 1573 | QString startString = ""; |
1574 | if ( incidence->type() != "Todo" ) { | 1574 | if ( incidence->type() != "Todo" ) { |
1575 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { | 1575 | if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { |
1576 | if ( incidence->doesFloat() ) { | 1576 | if ( incidence->doesFloat() ) { |
1577 | startString += ": "+incidence->dtStartDateStr( true ); | 1577 | startString += ": "+incidence->dtStartDateStr( true ); |
1578 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); | 1578 | startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); |
1579 | 1579 | ||
1580 | } else { | 1580 | } else { |
1581 | startString = ": "+incidence->dtStartStr(true); | 1581 | startString = ": "+incidence->dtStartStr(true); |
1582 | startString += " --- "+((Event*)incidence)->dtEndStr(true); | 1582 | startString += " --- "+((Event*)incidence)->dtEndStr(true); |
1583 | 1583 | ||
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | } else { | 1586 | } else { |
1587 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) | 1587 | if ( incidence->dtStart().time() != incidence->dtEnd().time() ) |
1588 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ | 1588 | startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ |
1589 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); | 1589 | "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); |
1590 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { | 1590 | if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { |
1591 | bool ok; | 1591 | bool ok; |
1592 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); | 1592 | QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); |
1593 | if ( ok ) { | 1593 | if ( ok ) { |
1594 | int years = noc.date().year() - incidence->dtStart().date().year(); | 1594 | int years = noc.date().year() - incidence->dtStart().date().year(); |
1595 | startString += i18n(" (%1 y.)"). arg( years ); | 1595 | startString += i18n(" (%1 y.)"). arg( years ); |
1596 | } | 1596 | } |
1597 | } | 1597 | } |
1598 | else | 1598 | else |
1599 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); | 1599 | startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); |
1600 | } | 1600 | } |
1601 | 1601 | ||
1602 | } | 1602 | } |
1603 | else | 1603 | else |
1604 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); | 1604 | startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); |
1605 | if ( !incidence->location().isEmpty() ) | 1605 | if ( !incidence->location().isEmpty() ) |
1606 | startString += " (" +incidence->location()+")"; | 1606 | startString += " (" +incidence->location()+")"; |
1607 | setCaption( incidence->summary()+startString); | 1607 | setCaption( incidence->summary()+startString); |
1608 | 1608 | ||
1609 | enableIncidenceActions( true ); | 1609 | enableIncidenceActions( true ); |
1610 | 1610 | ||
1611 | if ( incidence->type() == "Event" ) { | 1611 | if ( incidence->type() == "Event" ) { |
1612 | mShowAction->setText( i18n("Show Event...") ); | 1612 | mShowAction->setText( i18n("Show Event...") ); |
1613 | mEditAction->setText( i18n("Edit Event...") ); | 1613 | mEditAction->setText( i18n("Edit Event...") ); |
1614 | mDeleteAction->setText( i18n("Delete Event...") ); | 1614 | mDeleteAction->setText( i18n("Delete Event...") ); |
1615 | 1615 | ||
1616 | mNewSubTodoAction->setEnabled( false ); | 1616 | mNewSubTodoAction->setEnabled( false ); |
1617 | } else if ( incidence->type() == "Todo" ) { | 1617 | } else if ( incidence->type() == "Todo" ) { |
1618 | mShowAction->setText( i18n("Show Todo...") ); | 1618 | mShowAction->setText( i18n("Show Todo...") ); |
1619 | mEditAction->setText( i18n("Edit Todo...") ); | 1619 | mEditAction->setText( i18n("Edit Todo...") ); |
1620 | mDeleteAction->setText( i18n("Delete Todo...") ); | 1620 | mDeleteAction->setText( i18n("Delete Todo...") ); |
1621 | 1621 | ||
1622 | mNewSubTodoAction->setEnabled( true ); | 1622 | mNewSubTodoAction->setEnabled( true ); |
1623 | } else { | 1623 | } else { |
1624 | mShowAction->setText( i18n("Show...") ); | 1624 | mShowAction->setText( i18n("Show...") ); |
1625 | mShowAction->setText( i18n("Edit...") ); | 1625 | mShowAction->setText( i18n("Edit...") ); |
1626 | mShowAction->setText( i18n("Delete...") ); | 1626 | mShowAction->setText( i18n("Delete...") ); |
1627 | 1627 | ||
1628 | mNewSubTodoAction->setEnabled( false ); | 1628 | mNewSubTodoAction->setEnabled( false ); |
1629 | } | 1629 | } |
1630 | } | 1630 | } |
1631 | 1631 | ||
1632 | void MainWindow::enableIncidenceActions( bool enabled ) | 1632 | void MainWindow::enableIncidenceActions( bool enabled ) |
1633 | { | 1633 | { |
1634 | mShowAction->setEnabled( enabled ); | 1634 | mShowAction->setEnabled( enabled ); |
1635 | mEditAction->setEnabled( enabled ); | 1635 | mEditAction->setEnabled( enabled ); |
1636 | mDeleteAction->setEnabled( enabled ); | 1636 | mDeleteAction->setEnabled( enabled ); |
1637 | 1637 | ||
1638 | mCloneAction->setEnabled( enabled ); | 1638 | mCloneAction->setEnabled( enabled ); |
1639 | mMoveAction->setEnabled( enabled ); | 1639 | mMoveAction->setEnabled( enabled ); |
1640 | mBeamAction->setEnabled( enabled ); | 1640 | mBeamAction->setEnabled( enabled ); |
1641 | mCancelAction->setEnabled( enabled ); | 1641 | mCancelAction->setEnabled( enabled ); |
1642 | } | 1642 | } |
1643 | 1643 | ||
1644 | void MainWindow::importOL() | 1644 | void MainWindow::importOL() |
1645 | { | 1645 | { |
1646 | #ifdef _OL_IMPORT_ | 1646 | #ifdef _OL_IMPORT_ |
1647 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); | 1647 | KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); |
1648 | id->exec(); | 1648 | id->exec(); |
1649 | delete id; | 1649 | delete id; |
1650 | mView->updateView(); | 1650 | mView->updateView(); |
1651 | #endif | 1651 | #endif |
1652 | } | 1652 | } |
1653 | void MainWindow::importBday() | 1653 | void MainWindow::importBday() |
1654 | { | 1654 | { |
1655 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1655 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1656 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), | 1656 | i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), |
1657 | i18n("Import!"), i18n("Cancel"), 0, | 1657 | i18n("Import!"), i18n("Cancel"), 0, |
1658 | 0, 1 ); | 1658 | 0, 1 ); |
1659 | if ( result == 0 ) { | 1659 | if ( result == 0 ) { |
1660 | mView->importBday(); | 1660 | mView->importBday(); |
1661 | 1661 | ||
1662 | } | 1662 | } |
1663 | 1663 | ||
1664 | 1664 | ||
1665 | } | 1665 | } |
1666 | void MainWindow::importQtopia() | 1666 | void MainWindow::importQtopia() |
1667 | { | 1667 | { |
1668 | //#ifndef DESKTOP_VERSION | 1668 | //#ifndef DESKTOP_VERSION |
1669 | QString mess = 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"); | 1669 | QString mess = 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"); |
1670 | #ifdef DESKTOP_VERSION | 1670 | #ifdef DESKTOP_VERSION |
1671 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); | 1671 | mess += i18n("The content of the following files will be\nimported (located in your home directory (hd)):\n(hd)/Applications/datebook/datebook.xml\n(hd)/Applications/todolist/todolist.xml\nThe following category file will be used:\n(hd)/Settings/Categories.xml"); |
1672 | #endif | 1672 | #endif |
1673 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, | 1673 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, |
1674 | i18n("Import!"), i18n("Cancel"), 0, | 1674 | i18n("Import!"), i18n("Cancel"), 0, |
1675 | 0, 1 ); | 1675 | 0, 1 ); |
1676 | if ( result == 0 ) { | 1676 | if ( result == 0 ) { |
1677 | #ifndef DESKTOP_VERSION | 1677 | #ifndef DESKTOP_VERSION |
1678 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); | 1678 | QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); |
1679 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); | 1679 | QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); |
1680 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; | 1680 | QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; |
1681 | #else | 1681 | #else |
1682 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; | 1682 | QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; |
1683 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; | 1683 | QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; |
1684 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; | 1684 | QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; |
1685 | #endif | 1685 | #endif |
1686 | mView->importQtopia( categories, datebook, todolist ); | 1686 | mView->importQtopia( categories, datebook, todolist ); |
1687 | } | 1687 | } |
1688 | #if 0 | 1688 | #if 0 |
1689 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 1689 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
1690 | i18n("Not supported \non desktop!\n"), | 1690 | i18n("Not supported \non desktop!\n"), |
1691 | i18n("Ok"), i18n("Cancel"), 0, | 1691 | i18n("Ok"), i18n("Cancel"), 0, |
1692 | 0, 1 ); | 1692 | 0, 1 ); |
1693 | 1693 | ||
1694 | #endif | 1694 | #endif |
1695 | } | 1695 | } |
1696 | 1696 | ||
1697 | void MainWindow::saveOnClose() | 1697 | void MainWindow::saveOnClose() |
1698 | { | 1698 | { |
1699 | KOPrefs *p = KOPrefs::instance(); | 1699 | KOPrefs *p = KOPrefs::instance(); |
1700 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); | 1700 | p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); |
1701 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); | 1701 | p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal ); |
1702 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); | 1702 | p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal ); |
1703 | if ( filterToolBar ) { | 1703 | if ( filterToolBar ) { |
1704 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); | 1704 | p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal ); |
1705 | } | 1705 | } |
1706 | #ifdef DESKTOP_VERSION | 1706 | #ifdef DESKTOP_VERSION |
1707 | 1707 | ||
1708 | QPoint myP; | 1708 | QPoint myP; |
1709 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1709 | myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1710 | if ( p->mToolBarHor ) | 1710 | if ( p->mToolBarHor ) |
1711 | p->mToolBarUp = myP.y() > height()/2; | 1711 | p->mToolBarUp = myP.y() > height()/2; |
1712 | else | 1712 | else |
1713 | p->mToolBarUp = myP.x() > width()/2; | 1713 | p->mToolBarUp = myP.x() > width()/2; |
1714 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1714 | myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1715 | if ( p->mToolBarHorV ) | 1715 | if ( p->mToolBarHorV ) |
1716 | p->mToolBarUpV = myP.y() > height()/2; | 1716 | p->mToolBarUpV = myP.y() > height()/2; |
1717 | else | 1717 | else |
1718 | p->mToolBarUpV = myP.x() > width()/2 ; | 1718 | p->mToolBarUpV = myP.x() > width()/2 ; |
1719 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1719 | myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1720 | if ( p->mToolBarHorN ) | 1720 | if ( p->mToolBarHorN ) |
1721 | p->mToolBarUpN = myP.y() > height()/2; | 1721 | p->mToolBarUpN = myP.y() > height()/2; |
1722 | else | 1722 | else |
1723 | p->mToolBarUpN = myP.x() > width()/2 ; | 1723 | p->mToolBarUpN = myP.x() > width()/2 ; |
1724 | if ( filterToolBar ) { | 1724 | if ( filterToolBar ) { |
1725 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); | 1725 | myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) ); |
1726 | if ( p->mToolBarHorF ) | 1726 | if ( p->mToolBarHorF ) |
1727 | p->mToolBarUpF = myP.y() > height()/2; | 1727 | p->mToolBarUpF = myP.y() > height()/2; |
1728 | else | 1728 | else |
1729 | p->mToolBarUpF = myP.x() > width()/2 ; | 1729 | p->mToolBarUpF = myP.x() > width()/2 ; |
1730 | } | 1730 | } |
1731 | #else | 1731 | #else |
1732 | if ( p->mToolBarHor ) | 1732 | if ( p->mToolBarHor ) |
1733 | p->mToolBarUp = iconToolBar->y() > height()/2; | 1733 | p->mToolBarUp = iconToolBar->y() > height()/2; |
1734 | else | 1734 | else |
1735 | p->mToolBarUp = iconToolBar->x() > width()/2; | 1735 | p->mToolBarUp = iconToolBar->x() > width()/2; |
1736 | if ( p->mToolBarHorV ) | 1736 | if ( p->mToolBarHorV ) |
1737 | p->mToolBarUpV = viewToolBar->y() > height()/2; | 1737 | p->mToolBarUpV = viewToolBar->y() > height()/2; |
1738 | else | 1738 | else |
1739 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; | 1739 | p->mToolBarUpV = viewToolBar->x() > width()/2 ; |
1740 | 1740 | ||
1741 | if ( p->mToolBarHorN ) | 1741 | if ( p->mToolBarHorN ) |
1742 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; | 1742 | p->mToolBarUpN = navigatorToolBar->y() > height()/2; |
1743 | else | 1743 | else |
1744 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; | 1744 | p->mToolBarUpN = navigatorToolBar->x() > width()/2 ; |
1745 | if ( filterToolBar ) { | 1745 | if ( filterToolBar ) { |
1746 | if ( p->mToolBarHorF ) | 1746 | if ( p->mToolBarHorF ) |
1747 | p->mToolBarUpF = filterToolBar->y() > height()/2; | 1747 | p->mToolBarUpF = filterToolBar->y() > height()/2; |
1748 | else | 1748 | else |
1749 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; | 1749 | p->mToolBarUpF = filterToolBar->x() > width()/2 ; |
1750 | } | 1750 | } |
1751 | #endif | 1751 | #endif |
1752 | 1752 | ||
1753 | 1753 | ||
1754 | mView->writeSettings(); | 1754 | mView->writeSettings(); |
1755 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) | 1755 | if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) |
1756 | save(); | 1756 | save(); |
1757 | } | 1757 | } |
1758 | void MainWindow::slotModifiedChanged( bool changed ) | 1758 | void MainWindow::slotModifiedChanged( bool changed ) |
1759 | { | 1759 | { |
1760 | if ( mBlockAtStartup ) | 1760 | if ( mBlockAtStartup ) |
1761 | return; | 1761 | return; |
1762 | 1762 | ||
1763 | int msec; | 1763 | int msec; |
1764 | // we store the changes after 1 minute, | 1764 | // we store the changes after 1 minute, |
1765 | // and for safety reasons after 10 minutes again | 1765 | // and for safety reasons after 10 minutes again |
1766 | if ( !mSyncManager->blockSave() ) | 1766 | if ( !mSyncManager->blockSave() ) |
1767 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; | 1767 | msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; |
1768 | else | 1768 | else |
1769 | msec = 1000 * 600; | 1769 | msec = 1000 * 600; |
1770 | mSaveTimer.start( msec, true ); // 1 minute | 1770 | mSaveTimer.start( msec, true ); // 1 minute |
1771 | qDebug("KO: Saving File in %d secs!", msec/1000); | 1771 | qDebug("KO: Saving File in %d secs!", msec/1000); |
1772 | mCalendarModifiedFlag = true; | 1772 | mCalendarModifiedFlag = true; |
1773 | } | 1773 | } |
1774 | void MainWindow::saveStopTimer() | 1774 | void MainWindow::saveStopTimer() |
1775 | { | 1775 | { |
1776 | mSaveTimer.stop(); | 1776 | mSaveTimer.stop(); |
1777 | if (mSaveTimer.isActive() ) | 1777 | if (mSaveTimer.isActive() ) |
1778 | qDebug("ti active "); | 1778 | qDebug("ti active "); |
1779 | else | 1779 | else |
1780 | qDebug("KO: Save timer stopped"); | 1780 | qDebug("KO: Save timer stopped"); |
1781 | } | 1781 | } |
1782 | void MainWindow::save() | 1782 | void MainWindow::save() |
1783 | { | 1783 | { |
1784 | if ( !mCalendarModifiedFlag ) { | 1784 | if ( !mCalendarModifiedFlag ) { |
1785 | qDebug("KO: Calendar not modified. Nothing saved."); | 1785 | qDebug("KO: Calendar not modified. Nothing saved."); |
1786 | return; | 1786 | return; |
1787 | } | 1787 | } |
1788 | if ( mSyncManager->blockSave() ) | 1788 | if ( mSyncManager->blockSave() ) |
1789 | return; | 1789 | return; |
1790 | mSyncManager->setBlockSave(true); | 1790 | mSyncManager->setBlockSave(true); |
1791 | if ( mView->checkFileVersion( defaultFileName()) ) { | 1791 | if ( mView->checkFileVersion( defaultFileName()) ) { |
1792 | QTime neededSaveTime = QDateTime::currentDateTime().time(); | 1792 | QTime neededSaveTime = QDateTime::currentDateTime().time(); |
1793 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); | 1793 | setCaption(i18n("KO/Pi:Saving Data to File ..." )); |
1794 | qDebug("KO: Start saving data to file!"); | 1794 | qDebug("KO: Start saving data to file!"); |
1795 | mView->saveCalendar( defaultFileName() ); | 1795 | mView->saveCalendar( defaultFileName() ); |
1796 | mCalendarModifiedFlag = false; | 1796 | mCalendarModifiedFlag = false; |
1797 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); | 1797 | int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); |
1798 | qDebug("KO: Needed %d ms for saving.",msNeeded ); | 1798 | qDebug("KO: Needed %d ms for saving.",msNeeded ); |
1799 | QString savemes; | 1799 | QString savemes; |
1800 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); | 1800 | savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); |
1801 | setCaption(savemes); | 1801 | setCaption(savemes); |
1802 | } else | 1802 | } else |
1803 | setCaption(i18n("Saving cancelled!")); | 1803 | setCaption(i18n("Saving cancelled!")); |
1804 | mSyncManager->setBlockSave( false ); | 1804 | mSyncManager->setBlockSave( false ); |
1805 | } | 1805 | } |
1806 | 1806 | ||
1807 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) | 1807 | void MainWindow::keyReleaseEvent ( QKeyEvent * e) |
1808 | { | 1808 | { |
1809 | if ( !e->isAutoRepeat() ) { | 1809 | if ( !e->isAutoRepeat() ) { |
1810 | mFlagKeyPressed = false; | 1810 | mFlagKeyPressed = false; |
1811 | } | 1811 | } |
1812 | } | 1812 | } |
1813 | void MainWindow::keyPressEvent ( QKeyEvent * e ) | 1813 | void MainWindow::keyPressEvent ( QKeyEvent * e ) |
1814 | { | 1814 | { |
1815 | qApp->processEvents(); | 1815 | qApp->processEvents(); |
1816 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { | 1816 | if ( e->isAutoRepeat() && !mFlagKeyPressed ) { |
1817 | e->ignore(); | 1817 | e->ignore(); |
1818 | // qDebug(" ignore %d",e->isAutoRepeat() ); | 1818 | // qDebug(" ignore %d",e->isAutoRepeat() ); |
1819 | return; | 1819 | return; |
1820 | } | 1820 | } |
1821 | if (! e->isAutoRepeat() ) | 1821 | if (! e->isAutoRepeat() ) |
1822 | mFlagKeyPressed = true; | 1822 | mFlagKeyPressed = true; |
1823 | KOPrefs *p = KOPrefs::instance(); | 1823 | KOPrefs *p = KOPrefs::instance(); |
1824 | bool showSelectedDates = false; | 1824 | bool showSelectedDates = false; |
1825 | int size; | 1825 | int size; |
1826 | int pro = 0; | 1826 | int pro = 0; |
1827 | //qDebug("MainWindow::keyPressEvent "); | 1827 | //qDebug("MainWindow::keyPressEvent "); |
1828 | switch ( e->key() ) { | 1828 | switch ( e->key() ) { |
1829 | case Qt::Key_Right: | 1829 | case Qt::Key_Right: |
1830 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1830 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1831 | mView->goNextMonth(); | 1831 | mView->goNextMonth(); |
1832 | else | 1832 | else |
1833 | mView->goNext(); | 1833 | mView->goNext(); |
1834 | showSelectedDates = true; | 1834 | showSelectedDates = true; |
1835 | break; | 1835 | break; |
1836 | case Qt::Key_Left: | 1836 | case Qt::Key_Left: |
1837 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1837 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1838 | mView->goPreviousMonth(); | 1838 | mView->goPreviousMonth(); |
1839 | else | 1839 | else |
1840 | mView->goPrevious(); | 1840 | mView->goPrevious(); |
1841 | showSelectedDates = true; | 1841 | showSelectedDates = true; |
1842 | break; | 1842 | break; |
1843 | case Qt::Key_Down: | 1843 | case Qt::Key_Down: |
1844 | mView->viewManager()->agendaView()->scrollOneHourDown(); | 1844 | mView->viewManager()->agendaView()->scrollOneHourDown(); |
1845 | break; | 1845 | break; |
1846 | case Qt::Key_Up: | 1846 | case Qt::Key_Up: |
1847 | mView->viewManager()->agendaView()->scrollOneHourUp(); | 1847 | mView->viewManager()->agendaView()->scrollOneHourUp(); |
1848 | break; | 1848 | break; |
1849 | case Qt::Key_K: | 1849 | case Qt::Key_K: |
1850 | mView->viewManager()->showMonthViewWeek(); | 1850 | mView->viewManager()->showMonthViewWeek(); |
1851 | break; | 1851 | break; |
1852 | case Qt::Key_I: | 1852 | case Qt::Key_I: |
1853 | mView->showIncidence(); | 1853 | mView->showIncidence(); |
1854 | break; | 1854 | break; |
1855 | case Qt::Key_Delete: | 1855 | case Qt::Key_Delete: |
1856 | case Qt::Key_Backspace: | 1856 | case Qt::Key_Backspace: |
1857 | mView->deleteIncidence(); | 1857 | mView->deleteIncidence(); |
1858 | break; | 1858 | break; |
1859 | case Qt::Key_D: | 1859 | case Qt::Key_D: |
1860 | mView->viewManager()->showDayView(); | 1860 | mView->viewManager()->showDayView(); |
1861 | showSelectedDates = true; | 1861 | showSelectedDates = true; |
1862 | break; | 1862 | break; |
1863 | case Qt::Key_O: | 1863 | case Qt::Key_O: |
1864 | mView->toggleFilerEnabled( ); | 1864 | mView->toggleFilerEnabled( ); |
1865 | break; | 1865 | break; |
1866 | case Qt::Key_0: | 1866 | case Qt::Key_0: |
1867 | case Qt::Key_1: | 1867 | case Qt::Key_1: |
1868 | case Qt::Key_2: | 1868 | case Qt::Key_2: |
1869 | case Qt::Key_3: | 1869 | case Qt::Key_3: |
1870 | case Qt::Key_4: | 1870 | case Qt::Key_4: |
1871 | case Qt::Key_5: | 1871 | case Qt::Key_5: |
1872 | case Qt::Key_6: | 1872 | case Qt::Key_6: |
1873 | case Qt::Key_7: | 1873 | case Qt::Key_7: |
1874 | case Qt::Key_8: | 1874 | case Qt::Key_8: |
1875 | case Qt::Key_9: | 1875 | case Qt::Key_9: |
1876 | pro = e->key()-48; | 1876 | pro = e->key()-48; |
1877 | if ( pro == 0 ) | 1877 | if ( pro == 0 ) |
1878 | pro = 10; | 1878 | pro = 10; |
1879 | if ( e->state() == Qt::ControlButton) | 1879 | if ( e->state() == Qt::ControlButton) |
1880 | pro += 10; | 1880 | pro += 10; |
1881 | break; | 1881 | break; |
1882 | case Qt::Key_M: | 1882 | case Qt::Key_M: |
1883 | mView->viewManager()->showMonthView(); | 1883 | mView->viewManager()->showMonthView(); |
1884 | showSelectedDates = true; | 1884 | showSelectedDates = true; |
1885 | break; | 1885 | break; |
1886 | case Qt::Key_Insert: | 1886 | case Qt::Key_Insert: |
1887 | mView->newEvent(); | 1887 | mView->newEvent(); |
1888 | break; | 1888 | break; |
1889 | case Qt::Key_S : | 1889 | case Qt::Key_S : |
1890 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) | 1890 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) |
1891 | mView->newSubTodo(); | 1891 | mView->newSubTodo(); |
1892 | else | 1892 | else |
1893 | mView->dialogManager()->showSearchDialog(); | 1893 | mView->dialogManager()->showSearchDialog(); |
1894 | break; | 1894 | break; |
1895 | case Qt::Key_Y : | 1895 | case Qt::Key_Y : |
1896 | case Qt::Key_Z : | 1896 | case Qt::Key_Z : |
1897 | mView->viewManager()->showWorkWeekView(); | 1897 | mView->viewManager()->showWorkWeekView(); |
1898 | showSelectedDates = true; | 1898 | showSelectedDates = true; |
1899 | break; | 1899 | break; |
1900 | case Qt::Key_U : | 1900 | case Qt::Key_U : |
1901 | mView->viewManager()->showWeekView(); | 1901 | mView->viewManager()->showWeekView(); |
1902 | showSelectedDates = true; | 1902 | showSelectedDates = true; |
1903 | break; | 1903 | break; |
1904 | case Qt::Key_H : | 1904 | case Qt::Key_H : |
1905 | keyBindings(); | 1905 | keyBindings(); |
1906 | break; | 1906 | break; |
1907 | case Qt::Key_W: | 1907 | case Qt::Key_W: |
1908 | mView->viewManager()->showWhatsNextView(); | 1908 | mView->viewManager()->showWhatsNextView(); |
1909 | break; | 1909 | break; |
1910 | case Qt::Key_L: | 1910 | case Qt::Key_L: |
1911 | mView->viewManager()->showListView(); | 1911 | mView->viewManager()->showListView(); |
1912 | break; | 1912 | break; |
1913 | case Qt::Key_N: | 1913 | case Qt::Key_N: |
1914 | mView->viewManager()->showNextView(); | 1914 | mView->viewManager()->showNextView(); |
1915 | break; | 1915 | break; |
1916 | case Qt::Key_V: | 1916 | case Qt::Key_V: |
1917 | mView->viewManager()->showTodoView(); | 1917 | mView->viewManager()->showTodoView(); |
1918 | break; | 1918 | break; |
1919 | case Qt::Key_C: | 1919 | case Qt::Key_C: |
1920 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); | 1920 | mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); |
1921 | break; | 1921 | break; |
1922 | case Qt::Key_P: | 1922 | case Qt::Key_P: |
1923 | mView->showDatePicker( ); | 1923 | mView->showDatePicker( ); |
1924 | break; | 1924 | break; |
1925 | case Qt::Key_F: | 1925 | case Qt::Key_F: |
1926 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1926 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1927 | mView->editFilters(); | 1927 | mView->editFilters(); |
1928 | else | 1928 | else |
1929 | mView->toggleFilter(); | 1929 | mView->toggleFilter(); |
1930 | break; | 1930 | break; |
1931 | case Qt::Key_X: | 1931 | case Qt::Key_X: |
1932 | if ( e->state() == Qt::ControlButton ) | 1932 | if ( e->state() == Qt::ControlButton ) |
1933 | mView->toggleDateNavigatorWidget(); | 1933 | mView->toggleDateNavigatorWidget(); |
1934 | else { | 1934 | else { |
1935 | mView->viewManager()->showNextXView(); | 1935 | mView->viewManager()->showNextXView(); |
1936 | showSelectedDates = true; | 1936 | showSelectedDates = true; |
1937 | } | 1937 | } |
1938 | break; | 1938 | break; |
1939 | case Qt::Key_Space: | 1939 | case Qt::Key_Space: |
1940 | mView->toggleExpand(); | 1940 | mView->toggleExpand(); |
1941 | break; | 1941 | break; |
1942 | case Qt::Key_A: | 1942 | case Qt::Key_A: |
1943 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) | 1943 | if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton ) |
1944 | mView->showNextAlarms(); | 1944 | mView->showNextAlarms(); |
1945 | else | 1945 | else |
1946 | mView->toggleAllDaySize(); | 1946 | mView->toggleAllDaySize(); |
1947 | break; | 1947 | break; |
1948 | case Qt::Key_T: | 1948 | case Qt::Key_T: |
1949 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1949 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1950 | mView->newTodo(); | 1950 | mView->newTodo(); |
1951 | else { | 1951 | else { |
1952 | mView->goToday(); | 1952 | mView->goToday(); |
1953 | showSelectedDates = true; | 1953 | showSelectedDates = true; |
1954 | } | 1954 | } |
1955 | break; | 1955 | break; |
1956 | case Qt::Key_J: | 1956 | case Qt::Key_J: |
1957 | mView->viewManager()->showJournalView(); | 1957 | mView->viewManager()->showJournalView(); |
1958 | break; | 1958 | break; |
1959 | case Qt::Key_B: | 1959 | case Qt::Key_B: |
1960 | mView->editIncidenceDescription();; | 1960 | mView->editIncidenceDescription();; |
1961 | break; | 1961 | break; |
1962 | // case Qt::Key_Return: | 1962 | // case Qt::Key_Return: |
1963 | case Qt::Key_E: | 1963 | case Qt::Key_E: |
1964 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) | 1964 | if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) |
1965 | mView->newEvent(); | 1965 | mView->newEvent(); |
1966 | else | 1966 | else |
1967 | mView->editIncidence(); | 1967 | mView->editIncidence(); |
1968 | break; | 1968 | break; |
1969 | case Qt::Key_Plus: | 1969 | case Qt::Key_Plus: |
1970 | size = p->mHourSize +2; | 1970 | size = p->mHourSize +2; |
1971 | if ( size <= 22 ) | 1971 | if ( size <= 22 ) |
1972 | configureAgenda( size ); | 1972 | configureAgenda( size ); |
1973 | break; | 1973 | break; |
1974 | case Qt::Key_Minus: | 1974 | case Qt::Key_Minus: |
1975 | size = p->mHourSize - 2; | 1975 | size = p->mHourSize - 2; |
1976 | if ( size >= 4 ) | 1976 | if ( size >= 4 ) |
1977 | configureAgenda( size ); | 1977 | configureAgenda( size ); |
1978 | break; | 1978 | break; |
1979 | 1979 | ||
1980 | 1980 | ||
1981 | default: | 1981 | default: |
1982 | e->ignore(); | 1982 | e->ignore(); |
1983 | } | 1983 | } |
1984 | if ( pro > 0 ) { | 1984 | if ( pro > 0 ) { |
1985 | mView->selectFilter( pro-1 ); | 1985 | mView->selectFilter( pro-1 ); |
1986 | } | 1986 | } |
1987 | if ( showSelectedDates ) { | 1987 | if ( showSelectedDates ) { |
1988 | ;// setCaptionToDates(); | 1988 | ;// setCaptionToDates(); |
1989 | } | 1989 | } |
1990 | 1990 | ||
1991 | } | 1991 | } |
1992 | void MainWindow::fillFilterMenuTB() | 1992 | void MainWindow::fillFilterMenuTB() |
1993 | { | 1993 | { |
1994 | selectFilterMenuTB->clear(); | 1994 | selectFilterMenuTB->clear(); |
1995 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); | 1995 | selectFilterMenuTB->insertItem(i18n ( "Edit Filters" ), 0 ); |
1996 | selectFilterMenuTB->insertSeparator(); | 1996 | selectFilterMenuTB->insertSeparator(); |
1997 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); | 1997 | selectFilterMenuTB->insertItem(i18n ( "No Filter" ), 1 ); |
1998 | 1998 | ||
1999 | selectFilterMenuTB->insertSeparator(); | 1999 | selectFilterMenuTB->insertSeparator(); |
2000 | QPtrList<CalFilter> fili = mView->filters(); | 2000 | QPtrList<CalFilter> fili = mView->filters(); |
2001 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2001 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2002 | CalFilter *filter = fili.first(); | 2002 | CalFilter *filter = fili.first(); |
2003 | int iii = 2; | 2003 | int iii = 2; |
2004 | bool checkitem = mView->filterView()->filtersEnabled(); | 2004 | bool checkitem = mView->filterView()->filtersEnabled(); |
2005 | while(filter) { | 2005 | while(filter) { |
2006 | selectFilterMenuTB->insertItem( filter->name(), iii ); | 2006 | selectFilterMenuTB->insertItem( filter->name(), iii ); |
2007 | if ( filter == curfilter) | 2007 | if ( filter == curfilter) |
2008 | selectFilterMenuTB->setItemChecked( iii, checkitem ); | 2008 | selectFilterMenuTB->setItemChecked( iii, checkitem ); |
2009 | filter = fili.next(); | 2009 | filter = fili.next(); |
2010 | ++iii; | 2010 | ++iii; |
2011 | } | 2011 | } |
2012 | if ( !checkitem ) | 2012 | if ( !checkitem ) |
2013 | selectFilterMenuTB->setItemChecked( 1, true ); | 2013 | selectFilterMenuTB->setItemChecked( 1, true ); |
2014 | 2014 | ||
2015 | int x = 0; | 2015 | int x = 0; |
2016 | int y = iconToolBar->height(); | 2016 | int y = iconToolBar->height(); |
2017 | int dX = 0; | 2017 | int dX = 0; |
2018 | int dY = 0; | 2018 | int dY = 0; |
2019 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2019 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2020 | if ( iconToolBar->y() > height()/2 ) { | 2020 | if ( iconToolBar->y() > height()/2 ) { |
2021 | dY = selectFilterMenuTB->sizeHint().height()+8; | 2021 | dY = selectFilterMenuTB->sizeHint().height()+8; |
2022 | y = 0; | 2022 | y = 0; |
2023 | } | 2023 | } |
2024 | } else { | 2024 | } else { |
2025 | if ( iconToolBar->x() > width()/2 ) { // right side | 2025 | if ( iconToolBar->x() > width()/2 ) { // right side |
2026 | x=0; | 2026 | x=0; |
2027 | dX= selectFilterMenuTB->sizeHint().width()+8; | 2027 | dX= selectFilterMenuTB->sizeHint().width()+8; |
2028 | y = 0; | 2028 | y = 0; |
2029 | } else { | 2029 | } else { |
2030 | x= iconToolBar->width(); | 2030 | x= iconToolBar->width(); |
2031 | y = 0; | 2031 | y = 0; |
2032 | } | 2032 | } |
2033 | } | 2033 | } |
2034 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2034 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2035 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); | 2035 | selectFilterMenuTB->popup(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))); |
2036 | } | 2036 | } |
2037 | void MainWindow::fillFilterMenu() | 2037 | void MainWindow::fillFilterMenu() |
2038 | { | 2038 | { |
2039 | selectFilterMenu->clear(); | 2039 | selectFilterMenu->clear(); |
2040 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); | 2040 | selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); |
2041 | selectFilterMenu->insertSeparator(); | 2041 | selectFilterMenu->insertSeparator(); |
2042 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); | 2042 | selectFilterMenu->insertItem(i18n ( "No Filter" ), 1 ); |
2043 | 2043 | ||
2044 | selectFilterMenu->insertSeparator(); | 2044 | selectFilterMenu->insertSeparator(); |
2045 | QPtrList<CalFilter> fili = mView->filters(); | 2045 | QPtrList<CalFilter> fili = mView->filters(); |
2046 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2046 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2047 | CalFilter *filter = fili.first(); | 2047 | CalFilter *filter = fili.first(); |
2048 | int iii = 2; | 2048 | int iii = 2; |
2049 | bool checkitem = mView->filterView()->filtersEnabled(); | 2049 | bool checkitem = mView->filterView()->filtersEnabled(); |
2050 | while(filter) { | 2050 | while(filter) { |
2051 | selectFilterMenu->insertItem( filter->name(), iii ); | 2051 | selectFilterMenu->insertItem( filter->name(), iii ); |
2052 | if ( filter == curfilter) | 2052 | if ( filter == curfilter) |
2053 | selectFilterMenu->setItemChecked( iii, checkitem ); | 2053 | selectFilterMenu->setItemChecked( iii, checkitem ); |
2054 | filter = fili.next(); | 2054 | filter = fili.next(); |
2055 | ++iii; | 2055 | ++iii; |
2056 | } | 2056 | } |
2057 | if ( !checkitem ) | 2057 | if ( !checkitem ) |
2058 | selectFilterMenu->setItemChecked( 1, true ); | 2058 | selectFilterMenu->setItemChecked( 1, true ); |
2059 | } | 2059 | } |
2060 | void MainWindow::fillFilterMenuPopup() | 2060 | void MainWindow::fillFilterMenuPopup() |
2061 | { | 2061 | { |
2062 | filterPopupMenu->clear(); | 2062 | filterPopupMenu->clear(); |
2063 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); | 2063 | filterPopupMenu->insertItem(i18n ( "No Filter" ), 0 ); |
2064 | 2064 | ||
2065 | filterPopupMenu->insertSeparator(); | 2065 | filterPopupMenu->insertSeparator(); |
2066 | QPtrList<CalFilter> fili = mView->filters(); | 2066 | QPtrList<CalFilter> fili = mView->filters(); |
2067 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2067 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2068 | CalFilter *filter = fili.first(); | 2068 | CalFilter *filter = fili.first(); |
2069 | int iii = 1; | 2069 | int iii = 1; |
2070 | bool checkitem = mView->filterView()->filtersEnabled(); | 2070 | bool checkitem = mView->filterView()->filtersEnabled(); |
2071 | while(filter) { | 2071 | while(filter) { |
2072 | filterPopupMenu->insertItem( filter->name(), iii ); | 2072 | filterPopupMenu->insertItem( filter->name(), iii ); |
2073 | if ( filter == curfilter) | 2073 | if ( filter == curfilter) |
2074 | filterPopupMenu->setItemChecked( iii, checkitem ); | 2074 | filterPopupMenu->setItemChecked( iii, checkitem ); |
2075 | filter = fili.next(); | 2075 | filter = fili.next(); |
2076 | ++iii; | 2076 | ++iii; |
2077 | } | 2077 | } |
2078 | if ( !checkitem ) | 2078 | if ( !checkitem ) |
2079 | filterPopupMenu->setItemChecked( 0, true ); | 2079 | filterPopupMenu->setItemChecked( 0, true ); |
2080 | } | 2080 | } |
2081 | void MainWindow::selectFilter( int fil ) | 2081 | void MainWindow::selectFilter( int fil ) |
2082 | { | 2082 | { |
2083 | 2083 | ||
2084 | if ( fil == 0 ) { | 2084 | if ( fil == 0 ) { |
2085 | mView->editFilters( ); | 2085 | mView->editFilters( ); |
2086 | } else if ( fil == 1 ){ | 2086 | } else if ( fil == 1 ){ |
2087 | if ( mView->filterView()->filtersEnabled() ) | 2087 | if ( mView->filterView()->filtersEnabled() ) |
2088 | mView->toggleFilerEnabled( ); | 2088 | mView->toggleFilerEnabled( ); |
2089 | } else { | 2089 | } else { |
2090 | if ( !mView->filterView()->filtersEnabled() ) { | 2090 | if ( !mView->filterView()->filtersEnabled() ) { |
2091 | mView->filterView()->blockSignals( true ); | 2091 | mView->filterView()->blockSignals( true ); |
2092 | mView->toggleFilerEnabled( ); | 2092 | mView->toggleFilerEnabled( ); |
2093 | mView->filterView()->blockSignals( false ); | 2093 | mView->filterView()->blockSignals( false ); |
2094 | } | 2094 | } |
2095 | mView->selectFilter( fil-2 ); | 2095 | mView->selectFilter( fil-2 ); |
2096 | } | 2096 | } |
2097 | } | 2097 | } |
2098 | void MainWindow::updateFilterToolbar() | 2098 | void MainWindow::updateFilterToolbar() |
2099 | { | 2099 | { |
2100 | if ( filterMenubar ) { | 2100 | if ( filterMenubar ) { |
2101 | if ( !mView->filterView()->filtersEnabled() ) { | 2101 | if ( !mView->filterView()->filtersEnabled() ) { |
2102 | filterMenubar->changeItem( 0, i18n("No Filter") ); | 2102 | filterMenubar->changeItem( 0, i18n("No Filter") ); |
2103 | } else { | 2103 | } else { |
2104 | CalFilter *curfilter = mView->filterView()->selectedFilter(); | 2104 | CalFilter *curfilter = mView->filterView()->selectedFilter(); |
2105 | if ( curfilter ) { | 2105 | if ( curfilter ) { |
2106 | filterMenubar->changeItem( 0, curfilter->name() ); | 2106 | filterMenubar->changeItem( 0, curfilter->name() ); |
2107 | } | 2107 | } |
2108 | } | 2108 | } |
2109 | } | 2109 | } |
2110 | } | 2110 | } |
2111 | void MainWindow::selectFilterPopup( int fil ) | 2111 | void MainWindow::selectFilterPopup( int fil ) |
2112 | { | 2112 | { |
2113 | selectFilter( fil + 1 ); | 2113 | selectFilter( fil + 1 ); |
2114 | 2114 | ||
2115 | } | 2115 | } |
2116 | void MainWindow::configureToolBar( int item ) | 2116 | void MainWindow::configureToolBar( int item ) |
2117 | { | 2117 | { |
2118 | 2118 | ||
2119 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); | 2119 | configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); |
2120 | KOPrefs *p = KOPrefs::instance(); | 2120 | KOPrefs *p = KOPrefs::instance(); |
2121 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); | 2121 | p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); |
2122 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); | 2122 | p-> mShowIconOnetoolbar = configureToolBarMenu->isItemChecked( 6 ); |
2123 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); | 2123 | p-> mShowIconFilter = configureToolBarMenu->isItemChecked( 7 ); |
2124 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); | 2124 | p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); |
2125 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); | 2125 | p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); |
2126 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); | 2126 | p->mShowIconNavigator = configureToolBarMenu->isItemChecked( 22 ); |
2127 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); | 2127 | p->mShowIconAllday = configureToolBarMenu->isItemChecked( 24 ); |
2128 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); | 2128 | p->mShowIconFilterview = configureToolBarMenu->isItemChecked( 26 ); |
2129 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); | 2129 | p->mShowIconToggleFull = configureToolBarMenu->isItemChecked( 28 ); |
2130 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); | 2130 | p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); |
2131 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); | 2131 | p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); |
2132 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); | 2132 | p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); |
2133 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); | 2133 | p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); |
2134 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); | 2134 | p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); |
2135 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); | 2135 | p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); |
2136 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); | 2136 | p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); |
2137 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); | 2137 | p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); |
2138 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); | 2138 | p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); |
2139 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); | 2139 | p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); |
2140 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); | 2140 | p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); |
2141 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); | 2141 | p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); |
2142 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); | 2142 | p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); |
2143 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); | 2143 | p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); |
2144 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); | 2144 | p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); |
2145 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); | 2145 | p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); |
2146 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); | 2146 | p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); |
2147 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); | 2147 | p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); |
2148 | // initActions(); | 2148 | // initActions(); |
2149 | } | 2149 | } |
2150 | void MainWindow::setCaption ( const QString & c ) | 2150 | void MainWindow::setCaption ( const QString & c ) |
2151 | { | 2151 | { |
2152 | QString cap = c; | 2152 | QString cap = c; |
2153 | cap.replace( QRegExp("\n"), " " ); | 2153 | cap.replace( QRegExp("\n"), " " ); |
2154 | cap = cap.stripWhiteSpace(); | 2154 | cap = cap.stripWhiteSpace(); |
2155 | if ( cap.isEmpty() ) | 2155 | if ( cap.isEmpty() ) |
2156 | cap = "KO/Pi"; | 2156 | cap = "KO/Pi"; |
2157 | QWidget::setCaption( cap ); | 2157 | QWidget::setCaption( cap ); |
2158 | } | 2158 | } |
2159 | void MainWindow::setCaptionToDates() | 2159 | void MainWindow::setCaptionToDates() |
2160 | { | 2160 | { |
2161 | QString selDates; | 2161 | QString selDates; |
2162 | QDate date = mView->startDate(); | 2162 | QDate date = mView->startDate(); |
2163 | if ( ! date.isValid() ) { | 2163 | if ( ! date.isValid() ) { |
2164 | setCaption(""); | 2164 | setCaption(""); |
2165 | return; | 2165 | return; |
2166 | } | 2166 | } |
2167 | selDates = KGlobal::locale()->formatDate( date, true); | 2167 | selDates = KGlobal::locale()->formatDate( date, true); |
2168 | if (mView->startDate() < mView->endDate() ) | 2168 | if (mView->startDate() < mView->endDate() ) |
2169 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); | 2169 | selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); |
2170 | else { | 2170 | else { |
2171 | QString addString; | 2171 | QString addString; |
2172 | if ( date == QDateTime::currentDateTime().date() ) | 2172 | if ( date == QDateTime::currentDateTime().date() ) |
2173 | addString = i18n("Today"); | 2173 | addString = i18n("Today"); |
2174 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) | 2174 | else if ( date == QDateTime::currentDateTime().date().addDays(1) ) |
2175 | addString = i18n("Tomorrow"); | 2175 | addString = i18n("Tomorrow"); |
2176 | if ( !addString.isEmpty() ) | 2176 | if ( !addString.isEmpty() ) |
2177 | selDates = addString+", "+selDates ; | 2177 | selDates = addString+", "+selDates ; |
2178 | } | 2178 | } |
2179 | setCaption( i18n("Dates: ") + selDates ); | 2179 | setCaption( i18n("Dates: ") + selDates ); |
2180 | 2180 | ||
2181 | } | 2181 | } |
2182 | void MainWindow::showConfigureAgenda( ) | 2182 | void MainWindow::showConfigureAgenda( ) |
2183 | { | 2183 | { |
2184 | int iii; | 2184 | int iii; |
2185 | for ( iii = 1;iii<= 10 ;++iii ){ | 2185 | for ( iii = 1;iii<= 10 ;++iii ){ |
2186 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); | 2186 | configureAgendaMenu->setItemChecked( (iii+1)*2, false ); |
2187 | } | 2187 | } |
2188 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); | 2188 | configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); |
2189 | } | 2189 | } |
2190 | void MainWindow::configureAgenda( int item ) | 2190 | void MainWindow::configureAgenda( int item ) |
2191 | { | 2191 | { |
2192 | if ( KOPrefs::instance()->mHourSize == item ) | 2192 | if ( KOPrefs::instance()->mHourSize == item ) |
2193 | return; | 2193 | return; |
2194 | KOPrefs::instance()->mHourSize=item; | 2194 | KOPrefs::instance()->mHourSize=item; |
2195 | mView->viewManager()->agendaView()->updateConfig(); | 2195 | mView->viewManager()->agendaView()->updateConfig(); |
2196 | } | 2196 | } |
2197 | 2197 | ||
2198 | void MainWindow::saveCalendar() | 2198 | void MainWindow::saveCalendar() |
2199 | { | 2199 | { |
2200 | QString fn = KOPrefs::instance()->mLastSaveFile; | 2200 | QString fn = KOPrefs::instance()->mLastSaveFile; |
2201 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); | 2201 | fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); |
2202 | 2202 | ||
2203 | if ( fn == "" ) | 2203 | if ( fn == "" ) |
2204 | return; | 2204 | return; |
2205 | QFileInfo info; | 2205 | QFileInfo info; |
2206 | info.setFile( fn ); | 2206 | info.setFile( fn ); |
2207 | QString mes; | 2207 | QString mes; |
2208 | bool createbup = true; | 2208 | bool createbup = true; |
2209 | if ( info. exists() ) { | 2209 | if ( info. exists() ) { |
2210 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; | 2210 | mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; |
2211 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2211 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2212 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2212 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2213 | 0, 1 ); | 2213 | 0, 1 ); |
2214 | if ( result != 0 ) { | 2214 | if ( result != 0 ) { |
2215 | createbup = false; | 2215 | createbup = false; |
2216 | } | 2216 | } |
2217 | } | 2217 | } |
2218 | if ( createbup ) { | 2218 | if ( createbup ) { |
2219 | mView->saveCalendar( fn ); | 2219 | mView->saveCalendar( fn ); |
2220 | mes = i18n("KO/Pi:Saved %1").arg(fn); | 2220 | mes = i18n("KO/Pi:Saved %1").arg(fn); |
2221 | KOPrefs::instance()->mLastSaveFile = fn; | 2221 | KOPrefs::instance()->mLastSaveFile = fn; |
2222 | setCaption(mes); | 2222 | setCaption(mes); |
2223 | } | 2223 | } |
2224 | } | 2224 | } |
2225 | void MainWindow::loadCalendar() | 2225 | void MainWindow::loadCalendar() |
2226 | { | 2226 | { |
2227 | 2227 | ||
2228 | QString fn = KOPrefs::instance()->mLastLoadFile; | 2228 | QString fn = KOPrefs::instance()->mLastLoadFile; |
2229 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); | 2229 | fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); |
2230 | 2230 | ||
2231 | if ( fn == "" ) | 2231 | if ( fn == "" ) |
2232 | return; | 2232 | return; |
2233 | QFileInfo info; | 2233 | QFileInfo info; |
2234 | info.setFile( fn ); | 2234 | info.setFile( fn ); |
2235 | QString mess; | 2235 | QString mess; |
2236 | bool loadbup = true; | 2236 | bool loadbup = true; |
2237 | if ( info. exists() ) { | 2237 | if ( info. exists() ) { |
2238 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); | 2238 | mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); |
2239 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2239 | int result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2240 | mess, | 2240 | mess, |
2241 | i18n("Load!"), i18n("Cancel"), 0, | 2241 | i18n("Load!"), i18n("Cancel"), 0, |
2242 | 0, 1 ); | 2242 | 0, 1 ); |
2243 | if ( result != 0 ) { | 2243 | if ( result != 0 ) { |
2244 | loadbup = false; | 2244 | loadbup = false; |
2245 | } | 2245 | } |
2246 | } else { | 2246 | } else { |
2247 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2247 | QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2248 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, | 2248 | i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, |
2249 | 0, 1 ); | 2249 | 0, 1 ); |
2250 | 2250 | ||
2251 | return; | 2251 | return; |
2252 | } | 2252 | } |
2253 | if ( loadbup ) { | 2253 | if ( loadbup ) { |
2254 | mView->openCalendar( fn ); | 2254 | mView->openCalendar( fn ); |
2255 | KOPrefs::instance()->mLastLoadFile = fn; | 2255 | KOPrefs::instance()->mLastLoadFile = fn; |
2256 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; | 2256 | mess = i18n("KO/Pi:Loaded %1").arg(fn) ; |
2257 | setCaption(mess); | 2257 | setCaption(mess); |
2258 | } | 2258 | } |
2259 | 2259 | ||
2260 | } | 2260 | } |
2261 | void MainWindow::quickImportIcal() | 2261 | void MainWindow::quickImportIcal() |
2262 | { | 2262 | { |
2263 | importFile( KOPrefs::instance()->mLastImportFile, false ); | 2263 | importFile( KOPrefs::instance()->mLastImportFile, false ); |
2264 | } | 2264 | } |
2265 | void MainWindow::importFile( QString fn, bool quick ) | 2265 | void MainWindow::importFile( QString fn, bool quick ) |
2266 | { | 2266 | { |
2267 | QFileInfo info; | 2267 | QFileInfo info; |
2268 | info.setFile( fn ); | 2268 | info.setFile( fn ); |
2269 | QString mess; | 2269 | QString mess; |
2270 | bool loadbup = true; | 2270 | bool loadbup = true; |
2271 | if ( !info. exists() ) { | 2271 | if ( !info. exists() ) { |
2272 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); | 2272 | mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); |
2273 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), | 2273 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), |
2274 | mess ); | 2274 | mess ); |
2275 | return; | 2275 | return; |
2276 | } | 2276 | } |
2277 | int result = 0; | 2277 | int result = 0; |
2278 | if ( !quick ) { | 2278 | if ( !quick ) { |
2279 | 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 )); | 2279 | 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 )); |
2280 | result = QMessageBox::warning( this, "KO/Pi: Warning!", | 2280 | result = QMessageBox::warning( this, "KO/Pi: Warning!", |
2281 | mess, | 2281 | mess, |
2282 | "Import", "Cancel", 0, | 2282 | "Import", "Cancel", 0, |
2283 | 0, 1 ); | 2283 | 0, 1 ); |
2284 | } | 2284 | } |
2285 | if ( result == 0 ) { | 2285 | if ( result == 0 ) { |
2286 | if ( mView->openCalendar( fn, true )) { | 2286 | if ( mView->openCalendar( fn, true )) { |
2287 | KOPrefs::instance()->mLastImportFile = fn; | 2287 | KOPrefs::instance()->mLastImportFile = fn; |
2288 | setCaption(i18n("Imported file successfully")); | 2288 | setCaption(i18n("Imported file successfully")); |
2289 | } else { | 2289 | } else { |
2290 | setCaption(i18n("Error importing file")); | 2290 | setCaption(i18n("Error importing file")); |
2291 | } | 2291 | } |
2292 | } | 2292 | } |
2293 | } | 2293 | } |
2294 | 2294 | ||
2295 | void MainWindow::importIcal() | 2295 | void MainWindow::importIcal() |
2296 | { | 2296 | { |
2297 | 2297 | ||
2298 | QString fn =KOPrefs::instance()->mLastImportFile; | 2298 | QString fn =KOPrefs::instance()->mLastImportFile; |
2299 | 2299 | ||
2300 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); | 2300 | fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); |
2301 | if ( fn == "" ) | 2301 | if ( fn == "" ) |
2302 | return; | 2302 | return; |
2303 | importFile( fn, true ); | 2303 | importFile( fn, true ); |
2304 | 2304 | ||
2305 | } | 2305 | } |
2306 | 2306 | ||
2307 | void MainWindow::exportVCalendar() | 2307 | void MainWindow::exportVCalendar() |
2308 | { | 2308 | { |
2309 | QString fn = KOPrefs::instance()->mLastVcalFile; | 2309 | QString fn = KOPrefs::instance()->mLastVcalFile; |
2310 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); | 2310 | fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); |
2311 | if ( fn == "" ) | 2311 | if ( fn == "" ) |
2312 | return; | 2312 | return; |
2313 | QFileInfo info; | 2313 | QFileInfo info; |
2314 | info.setFile( fn ); | 2314 | info.setFile( fn ); |
2315 | QString mes; | 2315 | QString mes; |
2316 | bool createbup = true; | 2316 | bool createbup = true; |
2317 | if ( info. exists() ) { | 2317 | if ( info. exists() ) { |
2318 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); | 2318 | mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); |
2319 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, | 2319 | int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, |
2320 | i18n("Overwrite!"), i18n("Cancel"), 0, | 2320 | i18n("Overwrite!"), i18n("Cancel"), 0, |
2321 | 0, 1 ); | 2321 | 0, 1 ); |
2322 | if ( result != 0 ) { | 2322 | if ( result != 0 ) { |
2323 | createbup = false; | 2323 | createbup = false; |
2324 | } | 2324 | } |
2325 | } | 2325 | } |
2326 | if ( createbup ) { | 2326 | if ( createbup ) { |
2327 | if ( mView->exportVCalendar( fn ) ) { | 2327 | if ( mView->exportVCalendar( fn ) ) { |
2328 | KOPrefs::instance()->mLastVcalFile = fn; | 2328 | KOPrefs::instance()->mLastVcalFile = fn; |
2329 | if ( fn.length() > 20 ) | 2329 | if ( fn.length() > 20 ) |
2330 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; | 2330 | mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; |
2331 | else | 2331 | else |
2332 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); | 2332 | mes = i18n("KO/Pi:Exported to %1").arg(fn ); |
2333 | setCaption(mes); | 2333 | setCaption(mes); |
2334 | } | 2334 | } |
2335 | } | 2335 | } |
2336 | 2336 | ||
2337 | } | 2337 | } |
2338 | QString MainWindow::sentSyncFile() | 2338 | QString MainWindow::sentSyncFile() |
2339 | { | 2339 | { |
2340 | #ifdef DESKTOP_VERSION | 2340 | #ifdef DESKTOP_VERSION |
2341 | return locateLocal( "tmp", "copysynccal.ics" ); | 2341 | return locateLocal( "tmp", "copysynccal.ics" ); |
2342 | #else | 2342 | #else |
2343 | return QString( "/tmp/copysynccal.ics" ); | 2343 | return QString( "/tmp/copysynccal.ics" ); |
2344 | #endif | 2344 | #endif |
2345 | } | 2345 | } |
2346 | 2346 | ||
2347 | void MainWindow::syncFileRequest() | 2347 | void MainWindow::syncFileRequest() |
2348 | { | 2348 | { |
2349 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2349 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2350 | mSyncManager->slotSyncMenu( 999 ); | 2350 | mSyncManager->slotSyncMenu( 999 ); |
2351 | } | 2351 | } |
2352 | 2352 | ||
2353 | setCaption(i18n("Saving Data to temp file ..." )); | 2353 | setCaption(i18n("Saving Data to temp file ..." )); |
2354 | mView->saveCalendar( sentSyncFile() ); | 2354 | mView->saveCalendar( sentSyncFile() ); |
2355 | setCaption(i18n("Data saved to temp file!" )); | 2355 | setCaption(i18n("Data saved to temp file!" )); |
2356 | 2356 | ||
2357 | } | 2357 | } |
2358 | void MainWindow::getFile( bool success ) | 2358 | void MainWindow::getFile( bool success ) |
2359 | { | 2359 | { |
2360 | if ( ! success ) { | 2360 | if ( ! success ) { |
2361 | setCaption( i18n("Error receiving file. Nothing changed!") ); | 2361 | setCaption( i18n("Error receiving file. Nothing changed!") ); |
2362 | return; | 2362 | return; |
2363 | } | 2363 | } |
2364 | mView->openCalendar( sentSyncFile() ); | 2364 | mView->openCalendar( sentSyncFile() ); |
2365 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { | 2365 | if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { |
2366 | mSyncManager->slotSyncMenu( 999 ); | 2366 | mSyncManager->slotSyncMenu( 999 ); |
2367 | } | 2367 | } |
2368 | setCaption( i18n("Pi-Sync successful!") ); | 2368 | setCaption( i18n("Pi-Sync successful!") ); |
2369 | } | 2369 | } |
2370 | 2370 | ||
2371 | void MainWindow::printSel( ) | 2371 | void MainWindow::printSel( ) |
2372 | { | 2372 | { |
2373 | mView->viewManager()->agendaView()->agenda()->printSelection(); | 2373 | mView->viewManager()->agendaView()->agenda()->printSelection(); |
2374 | } | 2374 | } |
2375 | 2375 | ||
2376 | void MainWindow::printCal() | 2376 | void MainWindow::printCal() |
2377 | { | 2377 | { |
2378 | mView->print();//mCp->showDialog(); | 2378 | mView->print();//mCp->showDialog(); |
2379 | } | 2379 | } |
2380 | 2380 | ||
2381 | 2381 | ||
2382 | #include "libkdepim/kdatepicker.h" | 2382 | #include "libkdepim/kdatepicker.h" |
2383 | #include <kdatetbl.h> | 2383 | #include <kdatetbl.h> |
2384 | 2384 | ||
2385 | void MainWindow::weekAction() | 2385 | void MainWindow::weekAction() |
2386 | { | 2386 | { |
2387 | int month; | 2387 | int month; |
2388 | KPopupFrame* popup = new KPopupFrame(this); | 2388 | KPopupFrame* popup = new KPopupFrame(this); |
2389 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); | 2389 | KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); |
2390 | // ----- | 2390 | // ----- |
2391 | picker->resize(picker->sizeHint()); | 2391 | picker->resize(picker->sizeHint()); |
2392 | popup->setMainWidget(picker); | 2392 | popup->setMainWidget(picker); |
2393 | picker->setFocus(); | 2393 | picker->setFocus(); |
2394 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 2394 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
2395 | int x = 0; | 2395 | int x = 0; |
2396 | int y = iconToolBar->height(); | 2396 | int y = iconToolBar->height(); |
2397 | int dX = 0; | 2397 | int dX = 0; |
2398 | int dY = 0; | 2398 | int dY = 0; |
2399 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { | 2399 | if ( iconToolBar->orientation () == Qt:: Horizontal ) { |
2400 | if ( iconToolBar->y() > height()/2 ) { | 2400 | if ( iconToolBar->y() > height()/2 ) { |
2401 | dY = picker->sizeHint().height()+8; | 2401 | dY = picker->sizeHint().height()+8; |
2402 | y = 0; | 2402 | y = 0; |
2403 | } | 2403 | } |
2404 | } else { | 2404 | } else { |
2405 | if ( iconToolBar->x() > width()/2 ) { // right side | 2405 | if ( iconToolBar->x() > width()/2 ) { // right side |
2406 | x=0; | 2406 | x=0; |
2407 | dX= picker->sizeHint().width()+8; | 2407 | dX= picker->sizeHint().width()+8; |
2408 | y = 0; | 2408 | y = 0; |
2409 | } else { | 2409 | } else { |
2410 | x= iconToolBar->width(); | 2410 | x= iconToolBar->width(); |
2411 | y = 0; | 2411 | y = 0; |
2412 | } | 2412 | } |
2413 | } | 2413 | } |
2414 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); | 2414 | //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); |
2415 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) | 2415 | if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) |
2416 | { | 2416 | { |
2417 | month = picker->getResult(); | 2417 | month = picker->getResult(); |
2418 | emit selectWeek ( month ); | 2418 | emit selectWeek ( month ); |
2419 | //qDebug("weekSelected %d ", month); | 2419 | //qDebug("weekSelected %d ", month); |
2420 | } | 2420 | } |
2421 | delete popup; | 2421 | delete popup; |
2422 | } | 2422 | } |
2423 | 2423 | ||
2424 | void MainWindow::hideEvent ( QHideEvent * ) | 2424 | void MainWindow::hideEvent ( QHideEvent * ) |
2425 | { | 2425 | { |
2426 | QString message; | 2426 | QString message; |
2427 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); | 2427 | QDateTime nextA = mCalendar->nextAlarmEventDateTime(); |
2428 | if ( nextA.isValid() ) { | 2428 | if ( nextA.isValid() ) { |
2429 | QString sum = mCalendar->nextSummary(); | 2429 | QString sum = mCalendar->nextSummary(); |
2430 | 2430 | ||
2431 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); | 2431 | message = i18n("%1 %2 - %3 (next event/todo with alarm)").arg( KGlobal::locale()->formatTime(nextA.time() , false)).arg(sum ).arg( KGlobal::locale()->formatDate(nextA.date() , false)); |
2432 | setCaption( message ); | 2432 | setCaption( message ); |
2433 | } | 2433 | } |
2434 | } | 2434 | } |
2435 | 2435 | ||
2436 | void MainWindow::resizeEvent( QResizeEvent* e) | 2436 | void MainWindow::resizeEvent( QResizeEvent* e) |
2437 | { | 2437 | { |
2438 | #ifndef DESKTOP_VERSION | 2438 | #ifndef DESKTOP_VERSION |
2439 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar ) { | 2439 | if ( !KOPrefs::instance()->mShowIconFilter && !KOPrefs::instance()->mShowIconOnetoolbar && QApplication::desktop()->width() > 320) { |
2440 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) | 2440 | if (QApplication::desktop()->width() > QApplication::desktop()->height() ) |
2441 | filterToolBar->hide(); | 2441 | filterToolBar->hide(); |
2442 | else | 2442 | else |
2443 | filterToolBar->show(); | 2443 | filterToolBar->show(); |
2444 | } | 2444 | } |
2445 | #endif | 2445 | #endif |
2446 | QMainWindow::resizeEvent( e); | 2446 | QMainWindow::resizeEvent( e); |
2447 | } | 2447 | } |
diff --git a/microkde/ofontselector.cpp b/microkde/ofontselector.cpp index c8471cc..05095f3 100644 --- a/microkde/ofontselector.cpp +++ b/microkde/ofontselector.cpp | |||
@@ -1,412 +1,413 @@ | |||
1 | /* | 1 | /* |
2 | =. This file is part of the OPIE Project | 2 | =. This file is part of the OPIE Project |
3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> | 3 | .=l. Copyright (c) 2002 Robert Griebl <sandman@handhelds.org> |
4 | .>+-= | 4 | .>+-= |
5 | _;:, .> :=|. This library is free software; you can | 5 | _;:, .> :=|. This library is free software; you can |
6 | .> <`_, > . <= redistribute it and/or modify it under | 6 | .> <`_, > . <= redistribute it and/or modify it under |
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
8 | .="- .-=="i, .._ License as published by the Free Software | 8 | .="- .-=="i, .._ License as published by the Free Software |
9 | - . .-<_> .<> Foundation; either version 2 of the License, | 9 | - . .-<_> .<> Foundation; either version 2 of the License, |
10 | ._= =} : or (at your option) any later version. | 10 | ._= =} : or (at your option) any later version. |
11 | .%`+i> _;_. | 11 | .%`+i> _;_. |
12 | .i_,=:_. -<s. This library is distributed in the hope that | 12 | .i_,=:_. -<s. This library is distributed in the hope that |
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
14 | : .. .:, . . . without even the implied warranty of | 14 | : .. .:, . . . without even the implied warranty of |
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
17 | ..}^=.= = ; Library General Public License for more | 17 | ..}^=.= = ; Library General Public License for more |
18 | ++= -. .` .: details. | 18 | ++= -. .` .: details. |
19 | : = ...= . :.=- | 19 | : = ...= . :.=- |
20 | -. .:....=;==+<; You should have received a copy of the GNU | 20 | -. .:....=;==+<; You should have received a copy of the GNU |
21 | -_. . . )=. = Library General Public License along with | 21 | -_. . . )=. = Library General Public License along with |
22 | -- :-=` this library; see the file COPYING.LIB. | 22 | -- :-=` this library; see the file COPYING.LIB. |
23 | If not, write to the Free Software Foundation, | 23 | If not, write to the Free Software Foundation, |
24 | Inc., 59 Temple Place - Suite 330, | 24 | Inc., 59 Temple Place - Suite 330, |
25 | Boston, MA 02111-1307, USA. | 25 | Boston, MA 02111-1307, USA. |
26 | 26 | ||
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qlistbox.h> | 30 | #include <qlistbox.h> |
31 | #include <qcombobox.h> | 31 | #include <qcombobox.h> |
32 | #include <qlabel.h> | 32 | #include <qlabel.h> |
33 | #include <qfont.h> | 33 | #include <qfont.h> |
34 | #include <qmultilineedit.h> | 34 | #include <qmultilineedit.h> |
35 | 35 | ||
36 | #include <qpe/fontdatabase.h> | 36 | #include <qpe/fontdatabase.h> |
37 | 37 | ||
38 | #include "ofontselector.h" | 38 | #include "ofontselector.h" |
39 | 39 | ||
40 | class OFontSelectorPrivate { | 40 | class OFontSelectorPrivate { |
41 | public: | 41 | public: |
42 | QListBox * m_font_family_list; | 42 | QListBox * m_font_family_list; |
43 | QComboBox * m_font_style_list; | 43 | QComboBox * m_font_style_list; |
44 | QComboBox * m_font_size_list; | 44 | QComboBox * m_font_size_list; |
45 | QMultiLineEdit *m_preview; | 45 | QMultiLineEdit *m_preview; |
46 | 46 | ||
47 | bool m_pointbug : 1; | 47 | bool m_pointbug : 1; |
48 | 48 | ||
49 | FontDatabase m_fdb; | 49 | FontDatabase m_fdb; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | namespace { | 52 | namespace { |
53 | 53 | ||
54 | class FontListItem : public QListBoxText { | 54 | class FontListItem : public QListBoxText { |
55 | public: | 55 | public: |
56 | FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText ( ) | 56 | FontListItem ( const QString &t, const QStringList &styles, const QValueList<int> &sizes ) : QListBoxText ( ) |
57 | { | 57 | { |
58 | m_name = t; | 58 | m_name = t; |
59 | m_styles = styles; | 59 | m_styles = styles; |
60 | m_sizes = sizes; | 60 | m_sizes = sizes; |
61 | 61 | ||
62 | QString str = t; | 62 | QString str = t; |
63 | str [0] = str [0]. upper ( ); | 63 | str [0] = str [0]. upper ( ); |
64 | setText ( str ); | 64 | setText ( str ); |
65 | } | 65 | } |
66 | 66 | ||
67 | QString family ( ) const | 67 | QString family ( ) const |
68 | { | 68 | { |
69 | return m_name; | 69 | return m_name; |
70 | } | 70 | } |
71 | 71 | ||
72 | const QStringList &styles ( ) const | 72 | const QStringList &styles ( ) const |
73 | { | 73 | { |
74 | return m_styles; | 74 | return m_styles; |
75 | } | 75 | } |
76 | 76 | ||
77 | const QValueList<int> &sizes ( ) const | 77 | const QValueList<int> &sizes ( ) const |
78 | { | 78 | { |
79 | return m_sizes; | 79 | return m_sizes; |
80 | } | 80 | } |
81 | 81 | ||
82 | private: | 82 | private: |
83 | QStringList m_styles; | 83 | QStringList m_styles; |
84 | QValueList<int> m_sizes; | 84 | QValueList<int> m_sizes; |
85 | QString m_name; | 85 | QString m_name; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | 88 | ||
89 | static int findItemCB ( QComboBox *box, const QString &str ) | 89 | static int findItemCB ( QComboBox *box, const QString &str ) |
90 | { | 90 | { |
91 | for ( int i = 0; i < box-> count ( ); i++ ) { | 91 | for ( int i = 0; i < box-> count ( ); i++ ) { |
92 | if ( box-> text ( i ) == str ) | 92 | if ( box-> text ( i ) == str ) |
93 | return i; | 93 | return i; |
94 | } | 94 | } |
95 | return -1; | 95 | return -1; |
96 | } | 96 | } |
97 | 97 | ||
98 | } | 98 | } |
99 | /* static same as anon. namespace */ | 99 | /* static same as anon. namespace */ |
100 | static int qt_version ( ) | 100 | static int qt_version ( ) |
101 | { | 101 | { |
102 | const char *qver = qVersion ( ); | 102 | const char *qver = qVersion ( ); |
103 | 103 | ||
104 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); | 104 | return ( qver [0] - '0' ) * 100 + ( qver [2] - '0' ) * 10 + ( qver [4] - '0' ); |
105 | } | 105 | } |
106 | 106 | ||
107 | /** | 107 | /** |
108 | * Constructs the Selector object | 108 | * Constructs the Selector object |
109 | * @param withpreview If a font preview should be given | 109 | * @param withpreview If a font preview should be given |
110 | * @param parent The parent of the Font Selector | 110 | * @param parent The parent of the Font Selector |
111 | * @param name The name of the object | 111 | * @param name The name of the object |
112 | * @param fl WidgetFlags | 112 | * @param fl WidgetFlags |
113 | */ | 113 | */ |
114 | OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) | 114 | OFontSelector::OFontSelector ( bool withpreview, QWidget *parent, const char *name, WFlags fl ) : QWidget ( parent, name, fl ) |
115 | { | 115 | { |
116 | d = new OFontSelectorPrivate ( ); | 116 | d = new OFontSelectorPrivate ( ); |
117 | 117 | ||
118 | QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 ); | 118 | QGridLayout *gridLayout = new QGridLayout ( this, 0, 0, 4, 4 ); |
119 | gridLayout->setRowStretch ( 4, 10 ); | 119 | gridLayout->setRowStretch ( 4, 10 ); |
120 | 120 | ||
121 | d-> m_font_family_list = new QListBox( this, "FontListBox" ); | 121 | d-> m_font_family_list = new QListBox( this, "FontListBox" ); |
122 | gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 ); | 122 | gridLayout->addMultiCellWidget( d-> m_font_family_list, 0, 4, 0, 0 ); |
123 | connect( d-> m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); | 123 | connect( d-> m_font_family_list, SIGNAL( highlighted( int ) ), this, SLOT( fontFamilyClicked( int ) ) ); |
124 | 124 | ||
125 | QLabel *label = new QLabel( tr( "Style" ), this ); | 125 | QLabel *label = new QLabel( tr( "Style" ), this ); |
126 | gridLayout->addWidget( label, 0, 1 ); | 126 | gridLayout->addWidget( label, 0, 1 ); |
127 | 127 | ||
128 | d-> m_font_style_list = new QComboBox( this, "StyleListBox" ); | 128 | d-> m_font_style_list = new QComboBox( this, "StyleListBox" ); |
129 | connect( d-> m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); | 129 | connect( d-> m_font_style_list, SIGNAL( activated( int ) ), this, SLOT( fontStyleClicked( int ) ) ); |
130 | gridLayout->addWidget( d-> m_font_style_list, 1, 1 ); | 130 | gridLayout->addWidget( d-> m_font_style_list, 1, 1 ); |
131 | 131 | ||
132 | label = new QLabel( tr( "Size" ), this ); | 132 | label = new QLabel( tr( "Size" ), this ); |
133 | gridLayout->addWidget( label, 2, 1 ); | 133 | gridLayout->addWidget( label, 2, 1 ); |
134 | 134 | ||
135 | d-> m_font_size_list = new QComboBox( this, "SizeListBox" ); | 135 | d-> m_font_size_list = new QComboBox( this, "SizeListBox" ); |
136 | connect( d-> m_font_size_list, SIGNAL( activated( int ) ), | 136 | connect( d-> m_font_size_list, SIGNAL( activated( int ) ), |
137 | this, SLOT( fontSizeClicked( int ) ) ); | 137 | this, SLOT( fontSizeClicked( int ) ) ); |
138 | gridLayout->addWidget( d-> m_font_size_list, 3, 1 ); | 138 | gridLayout->addWidget( d-> m_font_size_list, 3, 1 ); |
139 | 139 | ||
140 | d-> m_pointbug = ( qt_version ( ) <= 233 ); | 140 | //d-> m_pointbug = ( qt_version ( ) <= 233 ); |
141 | d->m_pointbug = ( qt_version() == 232 || qt_version() == 233 ); // SharpROM uses 2.3.2 | ||
141 | 142 | ||
142 | if ( withpreview ) { | 143 | if ( withpreview ) { |
143 | d-> m_preview = new QMultiLineEdit ( this, "Preview" ); | 144 | d-> m_preview = new QMultiLineEdit ( this, "Preview" ); |
144 | d-> m_preview-> setAlignment ( AlignCenter ); | 145 | d-> m_preview-> setAlignment ( AlignCenter ); |
145 | d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth ); | 146 | d-> m_preview-> setWordWrap ( QMultiLineEdit::WidgetWidth ); |
146 | d-> m_preview-> setMargin ( 3 ); | 147 | d-> m_preview-> setMargin ( 3 ); |
147 | d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); | 148 | d-> m_preview-> setText ( tr( "The Quick Brown Fox Jumps Over The Lazy Dog" )); |
148 | gridLayout-> addRowSpacing ( 5, 4 ); | 149 | gridLayout-> addRowSpacing ( 5, 4 ); |
149 | gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 ); | 150 | gridLayout-> addMultiCellWidget ( d-> m_preview, 6, 6, 0, 1 ); |
150 | gridLayout-> setRowStretch ( 6, 5 ); | 151 | gridLayout-> setRowStretch ( 6, 5 ); |
151 | } | 152 | } |
152 | else | 153 | else |
153 | d-> m_preview = 0; | 154 | d-> m_preview = 0; |
154 | 155 | ||
155 | loadFonts ( d-> m_font_family_list ); | 156 | loadFonts ( d-> m_font_family_list ); |
156 | } | 157 | } |
157 | 158 | ||
158 | OFontSelector::~OFontSelector ( ) | 159 | OFontSelector::~OFontSelector ( ) |
159 | { | 160 | { |
160 | delete d; | 161 | delete d; |
161 | } | 162 | } |
162 | 163 | ||
163 | /** | 164 | /** |
164 | * This methods tries to set the font | 165 | * This methods tries to set the font |
165 | * @param f The wishes font | 166 | * @param f The wishes font |
166 | * @return success or failure | 167 | * @return success or failure |
167 | */ | 168 | */ |
168 | bool OFontSelector::setSelectedFont ( const QFont &f ) | 169 | bool OFontSelector::setSelectedFont ( const QFont &f ) |
169 | { | 170 | { |
170 | return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); | 171 | return setSelectedFont ( f. family ( ), d-> m_fdb. styleString ( f ), f. pointSize ( ), QFont::encodingName ( f. charSet ( ))); |
171 | } | 172 | } |
172 | 173 | ||
173 | 174 | ||
174 | /** | 175 | /** |
175 | * This is an overloaded method @see setSelectedFont | 176 | * This is an overloaded method @see setSelectedFont |
176 | * @param familyStr The family of the font | 177 | * @param familyStr The family of the font |
177 | * @param styleStr The style of the font | 178 | * @param styleStr The style of the font |
178 | * @param sizeVal The size of font | 179 | * @param sizeVal The size of font |
179 | * @param charset The charset to be used. Will be deprecated by QT3 | 180 | * @param charset The charset to be used. Will be deprecated by QT3 |
180 | */ | 181 | */ |
181 | bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) | 182 | bool OFontSelector::setSelectedFont ( const QString &familyStr, const QString &styleStr, int sizeVal, const QString & charset ) |
182 | { | 183 | { |
183 | QString sizeStr = QString::number ( sizeVal ); | 184 | QString sizeStr = QString::number ( sizeVal ); |
184 | 185 | ||
185 | QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr ); | 186 | QListBoxItem *family = d-> m_font_family_list-> findItem ( familyStr ); |
186 | if ( !family ) | 187 | if ( !family ) |
187 | family = d-> m_font_family_list-> findItem ( "Helvetica" ); | 188 | family = d-> m_font_family_list-> findItem ( "Helvetica" ); |
188 | if ( !family ) | 189 | if ( !family ) |
189 | family = d-> m_font_family_list-> firstItem ( ); | 190 | family = d-> m_font_family_list-> firstItem ( ); |
190 | d-> m_font_family_list-> setCurrentItem ( family ); | 191 | d-> m_font_family_list-> setCurrentItem ( family ); |
191 | fontFamilyClicked ( d-> m_font_family_list-> index ( family )); | 192 | fontFamilyClicked ( d-> m_font_family_list-> index ( family )); |
192 | 193 | ||
193 | int style = findItemCB ( d-> m_font_style_list, styleStr ); | 194 | int style = findItemCB ( d-> m_font_style_list, styleStr ); |
194 | if ( style < 0 ) | 195 | if ( style < 0 ) |
195 | style = findItemCB ( d-> m_font_style_list, "Regular" ); | 196 | style = findItemCB ( d-> m_font_style_list, "Regular" ); |
196 | if ( style < 0 && d-> m_font_style_list-> count ( ) > 0 ) | 197 | if ( style < 0 && d-> m_font_style_list-> count ( ) > 0 ) |
197 | style = 0; | 198 | style = 0; |
198 | d-> m_font_style_list-> setCurrentItem ( style ); | 199 | d-> m_font_style_list-> setCurrentItem ( style ); |
199 | fontStyleClicked ( style ); | 200 | fontStyleClicked ( style ); |
200 | 201 | ||
201 | int size = findItemCB ( d-> m_font_size_list, sizeStr ); | 202 | int size = findItemCB ( d-> m_font_size_list, sizeStr ); |
202 | if ( size < 0 ) | 203 | if ( size < 0 ) |
203 | size = findItemCB ( d-> m_font_size_list, "10" ); | 204 | size = findItemCB ( d-> m_font_size_list, "10" ); |
204 | if ( size < 0 && d-> m_font_size_list-> count ( ) > 0 ) | 205 | if ( size < 0 && d-> m_font_size_list-> count ( ) > 0 ) |
205 | size = 0; | 206 | size = 0; |
206 | d-> m_font_size_list-> setCurrentItem ( size ); | 207 | d-> m_font_size_list-> setCurrentItem ( size ); |
207 | fontSizeClicked ( size ); | 208 | fontSizeClicked ( size ); |
208 | 209 | ||
209 | return (( family ) && ( style >= 0 ) && ( size >= 0 )); | 210 | return (( family ) && ( style >= 0 ) && ( size >= 0 )); |
210 | } | 211 | } |
211 | 212 | ||
212 | /** | 213 | /** |
213 | * This method returns the name, style and size of the currently selected | 214 | * This method returns the name, style and size of the currently selected |
214 | * font or false if no font is selected | 215 | * font or false if no font is selected |
215 | * @param family The font family will be written there | 216 | * @param family The font family will be written there |
216 | * @param style The style will be written there | 217 | * @param style The style will be written there |
217 | * @param size The size will be written there | 218 | * @param size The size will be written there |
218 | * @return success or failure | 219 | * @return success or failure |
219 | */ | 220 | */ |
220 | bool OFontSelector::selectedFont ( QString &family, QString &style, int &size ) | 221 | bool OFontSelector::selectedFont ( QString &family, QString &style, int &size ) |
221 | { | 222 | { |
222 | QString dummy; | 223 | QString dummy; |
223 | return selectedFont ( family, style, size, dummy ); | 224 | return selectedFont ( family, style, size, dummy ); |
224 | } | 225 | } |
225 | 226 | ||
226 | 227 | ||
227 | /** | 228 | /** |
228 | * This method does return the font family or QString::null if there is | 229 | * This method does return the font family or QString::null if there is |
229 | * no font item selected | 230 | * no font item selected |
230 | * @return the font family | 231 | * @return the font family |
231 | */ | 232 | */ |
232 | QString OFontSelector::fontFamily ( ) const | 233 | QString OFontSelector::fontFamily ( ) const |
233 | { | 234 | { |
234 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); | 235 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); |
235 | 236 | ||
236 | return fli ? fli-> family ( ) : QString::null; | 237 | return fli ? fli-> family ( ) : QString::null; |
237 | } | 238 | } |
238 | 239 | ||
239 | /** | 240 | /** |
240 | * This method will return the style of the font or QString::null | 241 | * This method will return the style of the font or QString::null |
241 | * @return the style of the font | 242 | * @return the style of the font |
242 | */ | 243 | */ |
243 | QString OFontSelector::fontStyle ( ) const | 244 | QString OFontSelector::fontStyle ( ) const |
244 | { | 245 | { |
245 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); | 246 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); |
246 | int fst = d-> m_font_style_list-> currentItem ( ); | 247 | int fst = d-> m_font_style_list-> currentItem ( ); |
247 | 248 | ||
248 | return ( fli && fst >= 0 ) ? fli-> styles ( ) [fst] : QString::null; | 249 | return ( fli && fst >= 0 ) ? fli-> styles ( ) [fst] : QString::null; |
249 | } | 250 | } |
250 | 251 | ||
251 | /** | 252 | /** |
252 | * This method will return the font size or 10 if no font size is available | 253 | * This method will return the font size or 10 if no font size is available |
253 | */ | 254 | */ |
254 | int OFontSelector::fontSize ( ) const | 255 | int OFontSelector::fontSize ( ) const |
255 | { | 256 | { |
256 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); | 257 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); |
257 | int fsi = d-> m_font_size_list-> currentItem ( ); | 258 | int fsi = d-> m_font_size_list-> currentItem ( ); |
258 | 259 | ||
259 | return ( fli && fsi >= 0 ) ? fli-> sizes ( ) [fsi] : 10; | 260 | return ( fli && fsi >= 0 ) ? fli-> sizes ( ) [fsi] : 10; |
260 | } | 261 | } |
261 | 262 | ||
262 | /** | 263 | /** |
263 | * returns the charset of the font or QString::null | 264 | * returns the charset of the font or QString::null |
264 | */ | 265 | */ |
265 | QString OFontSelector::fontCharSet ( ) const | 266 | QString OFontSelector::fontCharSet ( ) const |
266 | { | 267 | { |
267 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); | 268 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( d-> m_font_family_list-> currentItem ( )); |
268 | 269 | ||
269 | return fli ? d-> m_fdb. charSets ( fli-> family ( )) [0] : QString::null; | 270 | return fli ? d-> m_fdb. charSets ( fli-> family ( )) [0] : QString::null; |
270 | } | 271 | } |
271 | 272 | ||
272 | /** | 273 | /** |
273 | * Overloaded member function see above | 274 | * Overloaded member function see above |
274 | * @see selectedFont | 275 | * @see selectedFont |
275 | */ | 276 | */ |
276 | bool OFontSelector::selectedFont ( QString &family, QString &style, int &size, QString &charset ) | 277 | bool OFontSelector::selectedFont ( QString &family, QString &style, int &size, QString &charset ) |
277 | { | 278 | { |
278 | int ffa = d-> m_font_family_list-> currentItem ( ); | 279 | int ffa = d-> m_font_family_list-> currentItem ( ); |
279 | int fst = d-> m_font_style_list-> currentItem ( ); | 280 | int fst = d-> m_font_style_list-> currentItem ( ); |
280 | int fsi = d-> m_font_size_list-> currentItem ( ); | 281 | int fsi = d-> m_font_size_list-> currentItem ( ); |
281 | 282 | ||
282 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( ffa ); | 283 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( ffa ); |
283 | 284 | ||
284 | if ( fli ) { | 285 | if ( fli ) { |
285 | family = fli-> family ( ); | 286 | family = fli-> family ( ); |
286 | style = fst >= 0 ? fli-> styles ( ) [fst] : QString::null; | 287 | style = fst >= 0 ? fli-> styles ( ) [fst] : QString::null; |
287 | size = fsi >= 0 ? fli-> sizes ( ) [fsi] : 10; | 288 | size = fsi >= 0 ? fli-> sizes ( ) [fsi] : 10; |
288 | charset = d-> m_fdb. charSets ( fli-> family ( )) [0]; | 289 | charset = d-> m_fdb. charSets ( fli-> family ( )) [0]; |
289 | 290 | ||
290 | return true; | 291 | return true; |
291 | } | 292 | } |
292 | else | 293 | else |
293 | return false; | 294 | return false; |
294 | } | 295 | } |
295 | 296 | ||
296 | 297 | ||
297 | 298 | ||
298 | 299 | ||
299 | void OFontSelector::loadFonts ( QListBox *list ) | 300 | void OFontSelector::loadFonts ( QListBox *list ) |
300 | { | 301 | { |
301 | QStringList f = d-> m_fdb. families ( ); | 302 | QStringList f = d-> m_fdb. families ( ); |
302 | 303 | ||
303 | for ( QStringList::ConstIterator it = f. begin ( ); it != f. end ( ); ++it ) { | 304 | for ( QStringList::ConstIterator it = f. begin ( ); it != f. end ( ); ++it ) { |
304 | QValueList <int> ps = d-> m_fdb. pointSizes ( *it ); | 305 | QValueList <int> ps = d-> m_fdb. pointSizes ( *it ); |
305 | 306 | ||
306 | if ( d-> m_pointbug ) { | 307 | if ( d-> m_pointbug ) { |
307 | for ( QValueList <int>::Iterator it = ps. begin ( ); it != ps. end ( ); it++ ) | 308 | for ( QValueList <int>::Iterator it = ps. begin ( ); it != ps. end ( ); it++ ) |
308 | *it /= 10; | 309 | *it /= 10; |
309 | } | 310 | } |
310 | 311 | ||
311 | list-> insertItem ( new FontListItem ( *it, d-> m_fdb. styles ( *it ), ps )); | 312 | list-> insertItem ( new FontListItem ( *it, d-> m_fdb. styles ( *it ), ps )); |
312 | } | 313 | } |
313 | } | 314 | } |
314 | 315 | ||
315 | void OFontSelector::fontFamilyClicked ( int index ) | 316 | void OFontSelector::fontFamilyClicked ( int index ) |
316 | { | 317 | { |
317 | QString oldstyle = d-> m_font_style_list-> currentText ( ); | 318 | QString oldstyle = d-> m_font_style_list-> currentText ( ); |
318 | QString oldsize = d-> m_font_size_list-> currentText ( ); | 319 | QString oldsize = d-> m_font_size_list-> currentText ( ); |
319 | 320 | ||
320 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( index ); | 321 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( index ); |
321 | 322 | ||
322 | d-> m_font_style_list-> clear ( ); | 323 | d-> m_font_style_list-> clear ( ); |
323 | d-> m_font_style_list-> insertStringList ( fli-> styles ( )); | 324 | d-> m_font_style_list-> insertStringList ( fli-> styles ( )); |
324 | d-> m_font_style_list-> setEnabled ( !fli-> styles ( ). isEmpty ( )); | 325 | d-> m_font_style_list-> setEnabled ( !fli-> styles ( ). isEmpty ( )); |
325 | 326 | ||
326 | int i; | 327 | int i; |
327 | 328 | ||
328 | i = findItemCB ( d-> m_font_style_list, oldstyle ); | 329 | i = findItemCB ( d-> m_font_style_list, oldstyle ); |
329 | if ( i < 0 ) | 330 | if ( i < 0 ) |
330 | i = findItemCB ( d-> m_font_style_list, "Regular" ); | 331 | i = findItemCB ( d-> m_font_style_list, "Regular" ); |
331 | if (( i < 0 ) && ( d-> m_font_style_list-> count ( ) > 0 )) | 332 | if (( i < 0 ) && ( d-> m_font_style_list-> count ( ) > 0 )) |
332 | i = 0; | 333 | i = 0; |
333 | 334 | ||
334 | if ( i >= 0 ) { | 335 | if ( i >= 0 ) { |
335 | d-> m_font_style_list-> setCurrentItem ( i ); | 336 | d-> m_font_style_list-> setCurrentItem ( i ); |
336 | fontStyleClicked ( i ); | 337 | fontStyleClicked ( i ); |
337 | } | 338 | } |
338 | 339 | ||
339 | d-> m_font_size_list-> clear ( ); | 340 | d-> m_font_size_list-> clear ( ); |
340 | QValueList<int> sl = fli-> sizes ( ); | 341 | QValueList<int> sl = fli-> sizes ( ); |
341 | 342 | ||
342 | for ( QValueList<int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) | 343 | for ( QValueList<int>::Iterator it = sl. begin ( ); it != sl. end ( ); ++it ) |
343 | d-> m_font_size_list-> insertItem ( QString::number ( *it )); | 344 | d-> m_font_size_list-> insertItem ( QString::number ( *it )); |
344 | 345 | ||
345 | i = findItemCB ( d-> m_font_size_list, oldsize ); | 346 | i = findItemCB ( d-> m_font_size_list, oldsize ); |
346 | if ( i < 0 ) | 347 | if ( i < 0 ) |
347 | i = findItemCB ( d-> m_font_size_list, "10" ); | 348 | i = findItemCB ( d-> m_font_size_list, "10" ); |
348 | if (( i < 0 ) && ( d-> m_font_size_list-> count ( ) > 0 )) | 349 | if (( i < 0 ) && ( d-> m_font_size_list-> count ( ) > 0 )) |
349 | i = 0; | 350 | i = 0; |
350 | 351 | ||
351 | if ( i >= 0 ) { | 352 | if ( i >= 0 ) { |
352 | d-> m_font_size_list-> setCurrentItem ( i ); | 353 | d-> m_font_size_list-> setCurrentItem ( i ); |
353 | fontSizeClicked ( i ); | 354 | fontSizeClicked ( i ); |
354 | } | 355 | } |
355 | changeFont ( ); | 356 | changeFont ( ); |
356 | } | 357 | } |
357 | 358 | ||
358 | void OFontSelector::fontStyleClicked ( int /*index*/ ) | 359 | void OFontSelector::fontStyleClicked ( int /*index*/ ) |
359 | { | 360 | { |
360 | changeFont ( ); | 361 | changeFont ( ); |
361 | } | 362 | } |
362 | 363 | ||
363 | void OFontSelector::fontSizeClicked ( int /*index*/ ) | 364 | void OFontSelector::fontSizeClicked ( int /*index*/ ) |
364 | { | 365 | { |
365 | changeFont ( ); | 366 | changeFont ( ); |
366 | } | 367 | } |
367 | 368 | ||
368 | void OFontSelector::changeFont ( ) | 369 | void OFontSelector::changeFont ( ) |
369 | { | 370 | { |
370 | QFont f = selectedFont ( ); | 371 | QFont f = selectedFont ( ); |
371 | 372 | ||
372 | if ( d-> m_preview ) | 373 | if ( d-> m_preview ) |
373 | d-> m_preview-> setFont ( f ); | 374 | d-> m_preview-> setFont ( f ); |
374 | 375 | ||
375 | emit fontSelected ( f ); | 376 | emit fontSelected ( f ); |
376 | } | 377 | } |
377 | 378 | ||
378 | /** | 379 | /** |
379 | * Return the selected font | 380 | * Return the selected font |
380 | */ | 381 | */ |
381 | QFont OFontSelector::selectedFont ( ) | 382 | QFont OFontSelector::selectedFont ( ) |
382 | { | 383 | { |
383 | int ffa = d-> m_font_family_list-> currentItem ( ); | 384 | int ffa = d-> m_font_family_list-> currentItem ( ); |
384 | int fst = d-> m_font_style_list-> currentItem ( ); | 385 | int fst = d-> m_font_style_list-> currentItem ( ); |
385 | int fsi = d-> m_font_size_list-> currentItem ( ); | 386 | int fsi = d-> m_font_size_list-> currentItem ( ); |
386 | 387 | ||
387 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( ffa ); | 388 | FontListItem *fli = (FontListItem *) d-> m_font_family_list-> item ( ffa ); |
388 | 389 | ||
389 | if ( fli ) { | 390 | if ( fli ) { |
390 | return d-> m_fdb. font ( fli-> family ( ), \ | 391 | return d-> m_fdb. font ( fli-> family ( ), \ |
391 | fst >= 0 ? fli-> styles ( ) [fst] : QString::null, \ | 392 | fst >= 0 ? fli-> styles ( ) [fst] : QString::null, \ |
392 | fsi >= 0 ? fli-> sizes ( ) [fsi] : 10, \ | 393 | fsi >= 0 ? fli-> sizes ( ) [fsi] : 10, \ |
393 | d-> m_fdb. charSets ( fli-> family ( )) [0] ); | 394 | d-> m_fdb. charSets ( fli-> family ( )) [0] ); |
394 | } | 395 | } |
395 | else | 396 | else |
396 | return QFont ( ); | 397 | return QFont ( ); |
397 | } | 398 | } |
398 | 399 | ||
399 | 400 | ||
400 | void OFontSelector::resizeEvent ( QResizeEvent *re ) | 401 | void OFontSelector::resizeEvent ( QResizeEvent *re ) |
401 | { | 402 | { |
402 | if ( d-> m_preview ) { | 403 | if ( d-> m_preview ) { |
403 | d-> m_preview-> setMinimumHeight ( 1 ); | 404 | d-> m_preview-> setMinimumHeight ( 1 ); |
404 | d-> m_preview-> setMaximumHeight ( 32767 ); | 405 | d-> m_preview-> setMaximumHeight ( 32767 ); |
405 | } | 406 | } |
406 | 407 | ||
407 | QWidget::resizeEvent ( re ); | 408 | QWidget::resizeEvent ( re ); |
408 | 409 | ||
409 | if ( d-> m_preview ) | 410 | if ( d-> m_preview ) |
410 | d-> m_preview-> setFixedHeight ( d-> m_preview-> height ( )); | 411 | d-> m_preview-> setFixedHeight ( d-> m_preview-> height ( )); |
411 | 412 | ||
412 | } | 413 | } |
@@ -1 +1 @@ | |||
version = "2.0.24"; | version = "2.0.25"; | ||