summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt4
-rw-r--r--korganizer/mainwindow.cpp63
2 files changed, 37 insertions, 30 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index d5d1f76..d4ec863 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,191 +1,193 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.0.21 ************ 3********** VERSION 2.0.21 ************
4 4
5Fixed another SMTP problem in OM/Pi. 5Fixed another SMTP problem in OM/Pi.
6Some small changed in the new datenavigator in KO/Pi. 6Some small changed in the new datenavigator in KO/Pi.
7Changed default setting for new filter in KA/Pi to "exclude categories". 7Changed default setting for new filter in KA/Pi to "exclude categories".
8Changed the default font size for 640x480 display . 8Changed the default font size for 640x480 display .
9Changed popup menu behaviour in agenda and list view. 9Changed popup menu behaviour in agenda and list view.
10Fixed some layout problems of the date label size in the month view. 10Fixed some layout problems of the date label size in the month view.
11Made month view update faster. 11Made month view update faster.
12Made first datenavigator repainting faster. 12Made first datenavigator repainting faster.
13Changed the title of the event/todo edit dialogs. 13Changed the title of the event/todo edit dialogs.
14Timelabels in agenga changed from 22:00 to 22 oo. ( the oo higher, of course). 14Timelabels in agenga changed from 22:00 to 22 oo. ( the oo higher, of course).
15Please report, if there are layout problems with the new timelabels. 15Many small usebility fixes in KO/Pi.
16Pressing the "Calendar" button on the Z switches now to the next view in KO/Pi.
17The set of possible "next views" are the views you have toolbar buttons for.
16 18
17 19
18********** VERSION 2.0.20 ************ 20********** VERSION 2.0.20 ************
19 21
20Two small fixes in OM/Pi. 22Two small fixes in OM/Pi.
21 23
22Better resizing of the new datenavigator in KO/Pi. 24Better resizing of the new datenavigator in KO/Pi.
23 25
24********** VERSION 2.0.19 ************ 26********** VERSION 2.0.19 ************
25KO/Pi: 27KO/Pi:
26Enhancements and bugfixes in the new datenavigator. 28Enhancements and bugfixes in the new datenavigator.
27Bugfix in this changelog: 29Bugfix in this changelog:
28The datenavigator was changed in version 2.0.18, not the datepicker. 30The datenavigator was changed in version 2.0.18, not the datepicker.
29 31
30********** VERSION 2.0.18 ************ 32********** VERSION 2.0.18 ************
31KO/Pi: 33KO/Pi:
32Fixed some minor problems. 34Fixed some minor problems.
33Cleaned up the KO/Pi config dialog. 35Cleaned up the KO/Pi config dialog.
34Fixed problem moving events in aganda view. 36Fixed problem moving events in aganda view.
35Made datepicker scaleable, i.e. if the datenavigator shows now a 37Made datepicker scaleable, i.e. if the datenavigator shows now a
36datenavigator matrix depending on its size. 38datenavigator matrix depending on its size.
37Birthdays are now displayed green in the datenavigator. 39Birthdays are now displayed green in the datenavigator.
38What'sThis Help in datenavigator shows all events of the day. 40What'sThis Help in datenavigator shows all events of the day.
39 41
40OM/Pi: 42OM/Pi:
41Updated the backend mail library to the latest version. 43Updated the backend mail library to the latest version.
42Please backup your mail before using this version. 44Please backup your mail before using this version.
43 45
44********** VERSION 2.0.17 ************ 46********** VERSION 2.0.17 ************
45 47
46KO/Pi: 48KO/Pi:
47Tooltips in month view were not sorted. Fixed. 49Tooltips in month view were not sorted. Fixed.
48Daylabel in agenda view ( for display of one day ) was too short. Fixed. 50Daylabel in agenda view ( for display of one day ) was too short. Fixed.
49Conflict display dialog for syncing was not on top of other windows. Fixed. 51Conflict display dialog for syncing was not on top of other windows. Fixed.
50Fixed some minor problems. 52Fixed some minor problems.
51 53
52Fixed an endless loop when importing vcs file with RESOURCES entry. 54Fixed an endless loop when importing vcs file with RESOURCES entry.
53 55
54********** VERSION 2.0.16 ************ 56********** VERSION 2.0.16 ************
55OM/Pi: 57OM/Pi:
56Fixed the SMTP account setting the option. 58Fixed the SMTP account setting the option.
57Fixed something in mail sending. 59Fixed something in mail sending.
58 60
59KO/Pi: 61KO/Pi:
60Added possibility to export selected events/todos as vcal file. 62Added possibility to export selected events/todos as vcal file.
61 63
62********** VERSION 2.0.15 ************ 64********** VERSION 2.0.15 ************
63 65
64PwM/Pi: 66PwM/Pi:
65Added keyboard shorcuts for 67Added keyboard shorcuts for
66- toggling summary view (space bar) 68- toggling summary view (space bar)
67- delete item (delete + backspace key) 69- delete item (delete + backspace key)
68- add new item ( i + n key) 70- add new item ( i + n key)
69Fixed length of info in the title. 71Fixed length of info in the title.
70 72
71KO/Pi-KA/Pi: 73KO/Pi-KA/Pi:
72Changed "ME" menu bar entry to an icon. 74Changed "ME" menu bar entry to an icon.
73 75
74KO/Pi: 76KO/Pi:
75Fixed two minor bugs in displaying todos. 77Fixed two minor bugs in displaying todos.
76If in month view a cell is selected, the key shortcut "d" shows now that date. 78If in month view a cell is selected, the key shortcut "d" shows now that date.
77Added complete info for a todo in month view as an icon left of the text. 79Added complete info for a todo in month view as an icon left of the text.
78Fixed problems of displaying data when "<" or ">" are used in summary/location/description. 80Fixed problems of displaying data when "<" or ">" are used in summary/location/description.
79Fixed problem of search dialog size when switching displays. 81Fixed problem of search dialog size when switching displays.
80Cancel key now closes date picker. 82Cancel key now closes date picker.
81Rearranged KO/Pi file menu structure. 83Rearranged KO/Pi file menu structure.
82 84
83OM/Pi: 85OM/Pi:
84Added to the SMTP account setting the option 86Added to the SMTP account setting the option
85"No secure connection". 87"No secure connection".
86You have to configure your SMTP accounts again, sorry. 88You have to configure your SMTP accounts again, sorry.
87 89
88KA/Pi: 90KA/Pi:
89Added support for importing quoted-printable. 91Added support for importing quoted-printable.
90Support was added by Peter P.. Thanks, Peter! 92Support was added by Peter P.. Thanks, Peter!
91 93
92 94
93********** VERSION 2.0.14 ************ 95********** VERSION 2.0.14 ************
94 96
95Made Passwordmanager PwM/Pi more userfriendly: 97Made Passwordmanager PwM/Pi more userfriendly:
96Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more. 98Rearranged some toolbar icons, optimized setting of focus, fixed layout problems and more.
97Fixed bug in KO/Pi todo printing. 99Fixed bug in KO/Pi todo printing.
98Made Qtopia calendar import possible on desktop . 100Made Qtopia calendar import possible on desktop .
99 101
100********** VERSION 2.0.13 ************ 102********** VERSION 2.0.13 ************
101 103
102Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter. 104Fixed a problem in the addressee select dialog and made it more user friendly by adding a minimize splitter.
103 105
104In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down". 106In the search dialog you can switch now the focus from search line edit to the list view by pressing key "arrow down".
105 107
106OM/Pi: 108OM/Pi:
107Fixed a refresh problem of outgoing/sent/sendfailed folders after sending mails. 109Fixed a refresh problem of outgoing/sent/sendfailed folders after sending mails.
108Added missing German translation. 110Added missing German translation.
109Added warning if path is specified in local folder settings of account config. 111Added warning if path is specified in local folder settings of account config.
110 112
111********** VERSION 2.0.12 ************ 113********** VERSION 2.0.12 ************
112 114
113KO/Pi: 115KO/Pi:
114Fixed a bug in todo start/due date handling for non recurring todos with a start and due date. 116Fixed a bug in todo start/due date handling for non recurring todos with a start and due date.
115Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes. 117Fixed some layout problems in the KO/Pi agenda view when there were many conflicting itmes.
116Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer. 118Fixed several problems of the keyboard focus in the desktop versions when opening the search dialog/event viewer.
117 119
118Fixed problem in pi-sync mode when wrong password was sent. 120Fixed problem in pi-sync mode when wrong password was sent.
119 121
120OM/Pi: 122OM/Pi:
121Fixed a crash when displaying mails with "Show mail as html" was checked in the config. 123Fixed a crash when displaying mails with "Show mail as html" was checked in the config.
122Added a check before displaying the mail if the mail is in html format, if "Show mail as html" is enabled. 124Added a check before displaying the mail if the mail is in html format, if "Show mail as html" is enabled.
123 125
124********** VERSION 2.0.11 ************ 126********** VERSION 2.0.11 ************
125 127
126Fixed some problems in pi-sync mode 128Fixed some problems in pi-sync mode
127(e.g. details of events were not synced properly) 129(e.g. details of events were not synced properly)
128 130
129********** VERSION 2.0.10 ************ 131********** VERSION 2.0.10 ************
130 132
131KO/Pi: 133KO/Pi:
132In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view. 134In the desktop versions the context menu in the search dialog was broken after introducing the What'sThis info for the list view.
133This is fixed. 135This is fixed.
134Changed the search dialog a bit to make it more user friendly. 136Changed the search dialog a bit to make it more user friendly.
135(E.g.: Removed message box about "no items found" and set key focus to search line edit after search). 137(E.g.: Removed message box about "no items found" and set key focus to search line edit after search).
136 138
137Added config option to hide the week number in KO/Pi toolbar. 139Added config option to hide the week number in KO/Pi toolbar.
138 140
139********** VERSION 2.0.9 ************ 141********** VERSION 2.0.9 ************
140 142
141Made month view icons for multiday events a bit nicer. 143Made month view icons for multiday events a bit nicer.
142Some minor fixes in KO/Pi 144Some minor fixes in KO/Pi
143(e.g. go to today did not work for new week view properly). 145(e.g. go to today did not work for new week view properly).
144 146
145 147
146********** VERSION 2.0.8 ************ 148********** VERSION 2.0.8 ************
147 149
148Fixed a problem in dependency info in the ipk files for the Zaurus. 150Fixed a problem in dependency info in the ipk files for the Zaurus.
149 151
150Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar. 152Added icon for the stealth new week view and made navigation more user friendly in monthview by adding a prev/next week button to the navigator bar.
151 153
152Added a "go today" button to the datepicker. 154Added a "go today" button to the datepicker.
153 155
154Added "created" and "last modified" to event/todo viewer (and What'sThis viewer) 156Added "created" and "last modified" to event/todo viewer (and What'sThis viewer)
155and made it configureable to show these values. 157and made it configureable to show these values.
156 158
157Fixed a problem for events (from external iCal files) that do have a duration but no end date. 159Fixed a problem for events (from external iCal files) that do have a duration but no end date.
158 160
159 161
160********** VERSION 2.0.7 ************ 162********** VERSION 2.0.7 ************
161 163
162Added global application font settings 164Added global application font settings
163(for all KDE-Pim/Pi apps) to the general settings. 165(for all KDE-Pim/Pi apps) to the general settings.
164 166
165Fixed a problem in OM/Pi when trying to login to some IMAP servers 167Fixed a problem in OM/Pi when trying to login to some IMAP servers
166(like the IMAP server of Apple: mail.mac.com ) 168(like the IMAP server of Apple: mail.mac.com )
167 169
168Added recurring todos to KO/Pi. 170Added recurring todos to KO/Pi.
169 171
170 172
171********** VERSION 2.0.6 ************ 173********** VERSION 2.0.6 ************
172 174
173Stable release 2.0.6! 175Stable release 2.0.6!
174 176
175Some bugfixes in the pi-sync mode. 177Some bugfixes in the pi-sync mode.
176Added German translation for pi-sync mode. 178Added German translation for pi-sync mode.
177 179
178KO/Pi: 180KO/Pi:
179Made the todolist using alternate background. 181Made the todolist using alternate background.
180 182
181Other minor fixes in KO/Pi. 183Other minor fixes in KO/Pi.
182 184
183 185
184You can find the complete changelog 186You can find the complete changelog
185from version 1.7.7 to 2.0.5 187from version 1.7.7 to 2.0.5
186in the source package or on 188in the source package or on
187 189
188http://www.pi-sync.net/html/changelog.html 190http://www.pi-sync.net/html/changelog.html
189 191
190 192
191 193
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 24055af..95b836c 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,2130 +1,2135 @@
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 "klocale.h" 60#include "klocale.h"
61#include "kconfig.h" 61#include "kconfig.h"
62#include "simplealarmclient.h" 62#include "simplealarmclient.h"
63#include "externalapphandler.h" 63#include "externalapphandler.h"
64 64
65using namespace KCal; 65using namespace KCal;
66#ifndef _WIN32_ 66#ifndef _WIN32_
67#include <unistd.h> 67#include <unistd.h>
68#else 68#else
69#ifdef _OL_IMPORT_ 69#ifdef _OL_IMPORT_
70#include "koimportoldialog.h" 70#include "koimportoldialog.h"
71#endif 71#endif
72#endif 72#endif
73#include "mainwindow.h" 73#include "mainwindow.h"
74 74
75 75
76class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
77{ 77{
78 public: 78 public:
79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) : 79 KOex2phonePrefs( QWidget *parent=0, const char *name=0 ) :
80 QDialog( parent, name, true ) 80 QDialog( parent, name, true )
81 { 81 {
82 setCaption( i18n("Export to phone options") ); 82 setCaption( i18n("Export to phone options") );
83 QVBoxLayout* lay = new QVBoxLayout( this ); 83 QVBoxLayout* lay = new QVBoxLayout( this );
84 lay->setSpacing( 3 ); 84 lay->setSpacing( 3 );
85 lay->setMargin( 3 ); 85 lay->setMargin( 3 );
86 QLabel *lab; 86 QLabel *lab;
87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) ); 87 lay->addWidget(lab = new QLabel( i18n("Please read Help-Sync Howto\nto know what settings to use."), this ) );
88 lab->setAlignment (AlignHCenter ); 88 lab->setAlignment (AlignHCenter );
89 QHBox* temphb; 89 QHBox* temphb;
90 temphb = new QHBox( this ); 90 temphb = new QHBox( this );
91 new QLabel( i18n("I/O device: "), temphb ); 91 new QLabel( i18n("I/O device: "), temphb );
92 mPhoneDevice = new QLineEdit( temphb); 92 mPhoneDevice = new QLineEdit( temphb);
93 lay->addWidget( temphb ); 93 lay->addWidget( temphb );
94 temphb = new QHBox( this ); 94 temphb = new QHBox( this );
95 new QLabel( i18n("Connection: "), temphb ); 95 new QLabel( i18n("Connection: "), temphb );
96 mPhoneConnection = new QLineEdit( temphb); 96 mPhoneConnection = new QLineEdit( temphb);
97 lay->addWidget( temphb ); 97 lay->addWidget( temphb );
98 temphb = new QHBox( this ); 98 temphb = new QHBox( this );
99 new QLabel( i18n("Model(opt.): "), temphb ); 99 new QLabel( i18n("Model(opt.): "), temphb );
100 mPhoneModel = new QLineEdit( temphb); 100 mPhoneModel = new QLineEdit( temphb);
101 lay->addWidget( temphb ); 101 lay->addWidget( temphb );
102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this ); 102 mWriteBackFuture= new QCheckBox( i18n("Write back events in future only"), this );
103 mWriteBackFuture->setChecked( true ); 103 mWriteBackFuture->setChecked( true );
104 lay->addWidget( mWriteBackFuture ); 104 lay->addWidget( mWriteBackFuture );
105 temphb = new QHBox( this ); 105 temphb = new QHBox( this );
106 new QLabel( i18n("Max. weeks in future: ") , temphb ); 106 new QLabel( i18n("Max. weeks in future: ") , temphb );
107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb); 107 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, temphb);
108 mWriteBackFutureWeeks->setValue( 8 ); 108 mWriteBackFutureWeeks->setValue( 8 );
109 lay->addWidget( temphb ); 109 lay->addWidget( temphb );
110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) ); 110 lay->addWidget(lab = new QLabel( i18n("NOTE: This will remove all old\ntodo/calendar data on phone!"), this ) );
111 lab->setAlignment (AlignHCenter ); 111 lab->setAlignment (AlignHCenter );
112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this ); 112 QPushButton * ok = new QPushButton( i18n("Export to mobile phone!"), this );
113 lay->addWidget( ok ); 113 lay->addWidget( ok );
114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this ); 114 QPushButton * cancel = new QPushButton( i18n("Cancel"), this );
115 lay->addWidget( cancel ); 115 lay->addWidget( cancel );
116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); 116 connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); 117 connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
118 resize( 220, 240 ); 118 resize( 220, 240 );
119 qApp->processEvents(); 119 qApp->processEvents();
120 int dw = QApplication::desktop()->width(); 120 int dw = QApplication::desktop()->width();
121 int dh = QApplication::desktop()->height(); 121 int dh = QApplication::desktop()->height();
122 move( (dw-width())/2, (dh - height() )/2 ); 122 move( (dw-width())/2, (dh - height() )/2 );
123 } 123 }
124 124
125public: 125public:
126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel; 126 QLineEdit* mPhoneConnection, *mPhoneDevice, *mPhoneModel;
127 QCheckBox* mWriteBackFuture; 127 QCheckBox* mWriteBackFuture;
128 QSpinBox* mWriteBackFutureWeeks; 128 QSpinBox* mWriteBackFutureWeeks;
129}; 129};
130 130
131int globalFlagBlockStartup; 131int globalFlagBlockStartup;
132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 132MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
133 QMainWindow( parent, name ) 133 QMainWindow( parent, name )
134{ 134{
135 135
136 mClosed = false; 136 mClosed = false;
137 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 137 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
138 QString confFile = locateLocal("config","korganizerrc"); 138 QString confFile = locateLocal("config","korganizerrc");
139 QFileInfo finf ( confFile ); 139 QFileInfo finf ( confFile );
140 bool showWarning = !finf.exists(); 140 bool showWarning = !finf.exists();
141 setIcon(SmallIcon( "ko24" ) ); 141 setIcon(SmallIcon( "ko24" ) );
142 mBlockAtStartup = true; 142 mBlockAtStartup = true;
143 mFlagKeyPressed = false; 143 mFlagKeyPressed = false;
144 setCaption("KO/Pi"); 144 setCaption("KO/Pi");
145 KOPrefs *p = KOPrefs::instance(); 145 KOPrefs *p = KOPrefs::instance();
146 KPimGlobalPrefs::instance()->setGlobalConfig(); 146 KPimGlobalPrefs::instance()->setGlobalConfig();
147 if ( p->mHourSize > 22 ) 147 if ( p->mHourSize > 22 )
148 p->mHourSize = 22; 148 p->mHourSize = 22;
149 QMainWindow::ToolBarDock tbd; 149 QMainWindow::ToolBarDock tbd;
150 if ( p->mToolBarHor ) { 150 if ( p->mToolBarHor ) {
151 if ( p->mToolBarUp ) 151 if ( p->mToolBarUp )
152 tbd = Bottom; 152 tbd = Bottom;
153 else 153 else
154 tbd = Top; 154 tbd = Top;
155 } 155 }
156 else { 156 else {
157 if ( p->mToolBarUp ) 157 if ( p->mToolBarUp )
158 tbd = Right; 158 tbd = Right;
159 else 159 else
160 tbd = Left; 160 tbd = Left;
161 } 161 }
162 if ( KOPrefs::instance()->mUseAppColors ) 162 if ( KOPrefs::instance()->mUseAppColors )
163 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 163 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
164 globalFlagBlockStartup = 1; 164 globalFlagBlockStartup = 1;
165 iconToolBar = new QPEToolBar( this ); 165 iconToolBar = new QPEToolBar( this );
166 addToolBar (iconToolBar , tbd ); 166 addToolBar (iconToolBar , tbd );
167 mCalendarModifiedFlag = false; 167 mCalendarModifiedFlag = false;
168 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 168 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
169 splash->setAlignment ( AlignCenter ); 169 splash->setAlignment ( AlignCenter );
170 setCentralWidget( splash ); 170 setCentralWidget( splash );
171#ifndef DESKTOP_VERSION 171#ifndef DESKTOP_VERSION
172 showMaximized(); 172 showMaximized();
173#endif 173#endif
174 174
175 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 175 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
176 setDefaultPreferences(); 176 setDefaultPreferences();
177 mCalendar = new CalendarLocal(); 177 mCalendar = new CalendarLocal();
178 mView = new CalendarView( mCalendar, this,"mCalendar " ); 178 mView = new CalendarView( mCalendar, this,"mCalendar " );
179 mView->hide(); 179 mView->hide();
180 //mView->resize(splash->size() ); 180 //mView->resize(splash->size() );
181 initActions(); 181 initActions();
182 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu); 182 mSyncManager = new KSyncManager((QWidget*)this, (KSyncInterface*)mView, KSyncManager::KOPI, KOPrefs::instance(), syncMenu);
183 mSyncManager->setBlockSave(false); 183 mSyncManager->setBlockSave(false);
184 mView->setSyncManager(mSyncManager); 184 mView->setSyncManager(mSyncManager);
185#ifndef DESKTOP_VERSION 185#ifndef DESKTOP_VERSION
186 iconToolBar->show(); 186 iconToolBar->show();
187 qApp->processEvents(); 187 qApp->processEvents();
188#endif 188#endif
189 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 189 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
190 int vh = height() ; 190 int vh = height() ;
191 int vw = width(); 191 int vw = width();
192 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 192 //qDebug("Toolbar hei %d ",iconToolBar->height() );
193 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 193 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
194 vh -= iconToolBar->height(); 194 vh -= iconToolBar->height();
195 } else { 195 } else {
196 vw -= iconToolBar->height(); 196 vw -= iconToolBar->height();
197 } 197 }
198 //mView->setMaximumSize( splash->size() ); 198 //mView->setMaximumSize( splash->size() );
199 //mView->resize( splash->size() ); 199 //mView->resize( splash->size() );
200 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 200 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
201 mView->readSettings(); 201 mView->readSettings();
202 bool newFile = false; 202 bool newFile = false;
203 if( !QFile::exists( defaultFileName() ) ) { 203 if( !QFile::exists( defaultFileName() ) ) {
204 QFileInfo finfo ( defaultFileName() ); 204 QFileInfo finfo ( defaultFileName() );
205 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 205 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
206 qDebug("oldfile %s ", oldFile.latin1()); 206 qDebug("oldfile %s ", oldFile.latin1());
207 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"; 207 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";
208 finfo.setFile( oldFile ); 208 finfo.setFile( oldFile );
209 if (finfo.exists() ) { 209 if (finfo.exists() ) {
210 KMessageBox::information( this, message); 210 KMessageBox::information( this, message);
211 mView->openCalendar( oldFile ); 211 mView->openCalendar( oldFile );
212 qApp->processEvents(); 212 qApp->processEvents();
213 } else { 213 } else {
214 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 214 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
215 finfo.setFile( oldFile ); 215 finfo.setFile( oldFile );
216 if (finfo.exists() ) { 216 if (finfo.exists() ) {
217 KMessageBox::information( this, message); 217 KMessageBox::information( this, message);
218 mView->openCalendar( oldFile ); 218 mView->openCalendar( oldFile );
219 qApp->processEvents(); 219 qApp->processEvents();
220 } 220 }
221 } 221 }
222 mView->saveCalendar( defaultFileName() ); 222 mView->saveCalendar( defaultFileName() );
223 newFile = true; 223 newFile = true;
224 } 224 }
225 225
226 QTime neededSaveTime = QDateTime::currentDateTime().time(); 226 QTime neededSaveTime = QDateTime::currentDateTime().time();
227 mView->openCalendar( defaultFileName() ); 227 mView->openCalendar( defaultFileName() );
228 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 228 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
229 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 229 qDebug("KO: Calendar loading time: %d ms",msNeeded );
230 230
231 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) { 231 if ( KPimGlobalPrefs::instance()->mPreferredLanguage != KOPrefs::instance()->mOldLoadedLanguage ) {
232 KOPrefs::instance()->setAllDefaults(); 232 KOPrefs::instance()->setAllDefaults();
233 int count = mView->addCategories(); 233 int count = mView->addCategories();
234 } 234 }
235 processIncidenceSelection( 0 ); 235 processIncidenceSelection( 0 );
236 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 236 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
237 SLOT( processIncidenceSelection( Incidence * ) ) ); 237 SLOT( processIncidenceSelection( Incidence * ) ) );
238 connect( mView, SIGNAL( modifiedChanged( bool ) ), 238 connect( mView, SIGNAL( modifiedChanged( bool ) ),
239 SLOT( slotModifiedChanged( bool ) ) ); 239 SLOT( slotModifiedChanged( bool ) ) );
240 240
241 241
242 connect( mView, SIGNAL( tempDisableBR(bool) ), 242 connect( mView, SIGNAL( tempDisableBR(bool) ),
243 SLOT( disableBR(bool) ) ); 243 SLOT( disableBR(bool) ) );
244 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 244 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
245 mView->setModified( false ); 245 mView->setModified( false );
246 mBlockAtStartup = false; 246 mBlockAtStartup = false;
247 mView->setModified( false ); 247 mView->setModified( false );
248 setCentralWidget( mView ); 248 setCentralWidget( mView );
249 globalFlagBlockStartup = 0; 249 globalFlagBlockStartup = 0;
250 mView->show(); 250 mView->show();
251 delete splash; 251 delete splash;
252 if ( newFile ) 252 if ( newFile )
253 mView->updateConfig(); 253 mView->updateConfig();
254 // qApp->processEvents(); 254 // qApp->processEvents();
255 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 255 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
256 //fillSyncMenu(); 256 //fillSyncMenu();
257 257
258 258
259 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) ); 259 connect(mSyncManager , SIGNAL( save() ), this, SLOT( save() ) );
260 connect(mView , SIGNAL( save() ), this, SLOT( save() ) ); 260 connect(mView , SIGNAL( save() ), this, SLOT( save() ) );
261 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) ); 261 connect(mView , SIGNAL( saveStopTimer() ), this, SLOT( saveStopTimer() ) );
262 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) ); 262 connect(mSyncManager , SIGNAL( request_file() ), this, SLOT( syncFileRequest() ) );
263 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) ); 263 connect(mSyncManager , SIGNAL( getFile( bool )), this, SLOT(getFile( bool ) ) );
264 mSyncManager->setDefaultFileName( sentSyncFile()); 264 mSyncManager->setDefaultFileName( sentSyncFile());
265 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) ); 265 connect ( syncMenu, SIGNAL( activated ( int ) ), mSyncManager, SLOT (slotSyncMenu( int ) ) );
266 mSyncManager->fillSyncMenu(); 266 mSyncManager->fillSyncMenu();
267 267
268 268
269 269
270 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 270 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
271 if ( showWarning ) { 271 if ( showWarning ) {
272 KMessageBox::information( this, 272 KMessageBox::information( this,
273 "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"); 273 "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");
274 qApp->processEvents(); 274 qApp->processEvents();
275 mView->dialogManager()->showSyncOptions(); 275 mView->dialogManager()->showSyncOptions();
276 } 276 }
277 277
278 //US listen for result adressed from Ka/Pi 278 //US listen for result adressed from Ka/Pi
279#ifndef DESKTOP_VERSION 279#ifndef DESKTOP_VERSION
280 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 280 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
281#endif 281#endif
282#ifndef DESKTOP_VERSION 282#ifndef DESKTOP_VERSION
283 infrared = 0; 283 infrared = 0;
284#endif 284#endif
285 updateWeek( mView->startDate() ); 285 updateWeek( mView->startDate() );
286 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ), 286 connect( mView->dateNavigator(), SIGNAL( datesSelected( const KCal::DateList & ) ),
287 SLOT( updateWeekNum( const KCal::DateList & ) ) ); 287 SLOT( updateWeekNum( const KCal::DateList & ) ) );
288 mBRdisabled = false; 288 mBRdisabled = false;
289 //toggleBeamReceive(); 289 //toggleBeamReceive();
290} 290}
291MainWindow::~MainWindow() 291MainWindow::~MainWindow()
292{ 292{
293 //qDebug("MainWindow::~MainWindow() "); 293 //qDebug("MainWindow::~MainWindow() ");
294 //save toolbar location 294 //save toolbar location
295 delete mCalendar; 295 delete mCalendar;
296 delete mSyncManager; 296 delete mSyncManager;
297#ifndef DESKTOP_VERSION 297#ifndef DESKTOP_VERSION
298 if ( infrared ) 298 if ( infrared )
299 delete infrared; 299 delete infrared;
300#endif 300#endif
301 301
302 302
303} 303}
304 304
305void MainWindow::disableBR(bool b) 305void MainWindow::disableBR(bool b)
306{ 306{
307#ifndef DESKTOP_VERSION 307#ifndef DESKTOP_VERSION
308 if ( b ) { 308 if ( b ) {
309 if ( infrared ) { 309 if ( infrared ) {
310 toggleBeamReceive(); 310 toggleBeamReceive();
311 mBRdisabled = true; 311 mBRdisabled = true;
312 } 312 }
313 mBRdisabled = true; 313 mBRdisabled = true;
314 } else { 314 } else {
315 if ( mBRdisabled ) { 315 if ( mBRdisabled ) {
316 mBRdisabled = false; 316 mBRdisabled = false;
317 //makes no sense,because other cal ap is probably running 317 //makes no sense,because other cal ap is probably running
318 // toggleBeamReceive(); 318 // toggleBeamReceive();
319 } 319 }
320 } 320 }
321#endif 321#endif
322 322
323} 323}
324bool MainWindow::beamReceiveEnabled() 324bool MainWindow::beamReceiveEnabled()
325{ 325{
326#ifndef DESKTOP_VERSION 326#ifndef DESKTOP_VERSION
327 return ( infrared != 0 ); 327 return ( infrared != 0 );
328#endif 328#endif
329 return false; 329 return false;
330} 330}
331 331
332void MainWindow::toggleBeamReceive() 332void MainWindow::toggleBeamReceive()
333{ 333{
334 if ( mBRdisabled ) 334 if ( mBRdisabled )
335 return; 335 return;
336#ifndef DESKTOP_VERSION 336#ifndef DESKTOP_VERSION
337 if ( infrared ) { 337 if ( infrared ) {
338 qDebug("disable BeamReceive "); 338 qDebug("disable BeamReceive ");
339 delete infrared; 339 delete infrared;
340 infrared = 0; 340 infrared = 0;
341 brAction->setOn(false); 341 brAction->setOn(false);
342 return; 342 return;
343 } 343 }
344 qDebug("enable BeamReceive "); 344 qDebug("enable BeamReceive ");
345 brAction->setOn(true); 345 brAction->setOn(true);
346 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ; 346 infrared = new QCopChannel("QPE/Application/datebook",this, "channel" ) ;
347 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& ))); 347 QObject::connect( infrared, SIGNAL (received ( const QCString &, const QByteArray & )),this, SLOT(recieve( const QCString&, const QByteArray& )));
348#endif 348#endif
349} 349}
350void MainWindow::showMaximized () 350void MainWindow::showMaximized ()
351{ 351{
352#ifndef DESKTOP_VERSION 352#ifndef DESKTOP_VERSION
353 if ( ! globalFlagBlockStartup ) 353 if ( ! globalFlagBlockStartup )
354 if ( mClosed ) 354 if ( mClosed )
355 mView->goToday(); 355 mView->goToday();
356#endif 356#endif
357 QWidget::showMaximized () ; 357 QWidget::showMaximized () ;
358 mClosed = false; 358 mClosed = false;
359} 359}
360void MainWindow::closeEvent( QCloseEvent* ce ) 360void MainWindow::closeEvent( QCloseEvent* ce )
361{ 361{
362 362
363 363
364 364
365 if ( ! KOPrefs::instance()->mAskForQuit ) { 365 if ( ! KOPrefs::instance()->mAskForQuit ) {
366 saveOnClose(); 366 saveOnClose();
367 mClosed = true; 367 mClosed = true;
368 ce->accept(); 368 ce->accept();
369 return; 369 return;
370 370
371 } 371 }
372 372
373 switch( QMessageBox::information( this, "KO/Pi", 373 switch( QMessageBox::information( this, "KO/Pi",
374 i18n("Do you really want\nto close KO/Pi?"), 374 i18n("Do you really want\nto close KO/Pi?"),
375 i18n("Close"), i18n("No"), 375 i18n("Close"), i18n("No"),
376 0, 0 ) ) { 376 0, 0 ) ) {
377 case 0: 377 case 0:
378 saveOnClose(); 378 saveOnClose();
379 mClosed = true; 379 mClosed = true;
380 ce->accept(); 380 ce->accept();
381 break; 381 break;
382 case 1: 382 case 1:
383 ce->ignore(); 383 ce->ignore();
384 break; 384 break;
385 case 2: 385 case 2:
386 386
387 default: 387 default:
388 break; 388 break;
389 } 389 }
390 390
391 391
392} 392}
393 393
394void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 394void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
395{ 395{
396 QDataStream stream( data, IO_ReadOnly ); 396 QDataStream stream( data, IO_ReadOnly );
397 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 397 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
398 //QString datamess; 398 //QString datamess;
399 //qDebug("message "); 399 //qDebug("message ");
400 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 400 qDebug("KO: QCOP message received: %s ", cmsg.data() );
401 401
402 if ( cmsg == "setDocument(QString)" ) { 402 if ( cmsg == "setDocument(QString)" ) {
403 QDataStream stream( data, IO_ReadOnly ); 403 QDataStream stream( data, IO_ReadOnly );
404 QString fileName; 404 QString fileName;
405 stream >> fileName; 405 stream >> fileName;
406 //qDebug("filename %s ", fileName.latin1()); 406 //qDebug("filename %s ", fileName.latin1());
407 showMaximized(); 407 showMaximized();
408 raise(); 408 raise();
409 KOPrefs::instance()->mLastSyncedLocalFile = fileName ; 409 KOPrefs::instance()->mLastSyncedLocalFile = fileName ;
410 mSyncManager->slotSyncMenu( 1002 ); 410 mSyncManager->slotSyncMenu( 1002 );
411 return; 411 return;
412 } 412 }
413 413
414 if ( cmsg == "-writeFile" ) { 414 if ( cmsg == "-writeFile" ) {
415 // I made from the "-writeFile" an "-writeAlarm" 415 // I made from the "-writeFile" an "-writeAlarm"
416 mView->viewManager()->showWhatsNextView(); 416 mView->viewManager()->showWhatsNextView();
417 mCalendar->checkAlarmForIncidence( 0, true); 417 mCalendar->checkAlarmForIncidence( 0, true);
418 showMaximized(); 418 showMaximized();
419 raise(); 419 raise();
420 return; 420 return;
421 421
422 } 422 }
423 if ( cmsg == "-writeFileSilent" ) { 423 if ( cmsg == "-writeFileSilent" ) {
424 // I made from the "-writeFile" an "-writeAlarm" 424 // I made from the "-writeFile" an "-writeAlarm"
425 // mView->viewManager()->showWhatsNextView(); 425 // mView->viewManager()->showWhatsNextView();
426 mCalendar->checkAlarmForIncidence( 0, true); 426 mCalendar->checkAlarmForIncidence( 0, true);
427 //showMaximized(); 427 //showMaximized();
428 //raise(); 428 //raise();
429 hide(); 429 hide();
430 return; 430 return;
431 } 431 }
432 if ( cmsg == "-newCountdown" ) { 432 if ( cmsg == "-newCountdown" ) {
433 qDebug("newCountdown "); 433 qDebug("newCountdown ");
434 434
435 } 435 }
436 QString msg ; 436 QString msg ;
437 QString allmsg = cmsg; 437 QString allmsg = cmsg;
438 while ( allmsg.length() > 0 ) { 438 while ( allmsg.length() > 0 ) {
439 int nextC = allmsg.find( "-", 1 ); 439 int nextC = allmsg.find( "-", 1 );
440 if ( nextC == -1 ) { 440 if ( nextC == -1 ) {
441 msg = allmsg; 441 msg = allmsg;
442 allmsg = ""; 442 allmsg = "";
443 } else{ 443 } else{
444 msg = allmsg.left( nextC ); 444 msg = allmsg.left( nextC );
445 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 445 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
446 } 446 }
447 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 447 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
448 if ( msg == "-newEvent" ) { 448 if ( msg == "-newEvent" ) {
449 mView->newEvent(); 449 mView->newEvent();
450 } 450 }
451 if ( msg == "-newTodo" ) { 451 if ( msg == "-newTodo" ) {
452 mView->newTodo(); 452 mView->newTodo();
453 453
454 } 454 }
455 if ( msg == "-showWN" ) { 455 if ( msg == "-showWN" ) {
456 mView->viewManager()->showWhatsNextView(); 456 mView->viewManager()->showWhatsNextView();
457 } 457 }
458 if ( msg == "-showTodo" ) { 458 if ( msg == "-showTodo" ) {
459 mView->viewManager()->showTodoView(); 459 mView->viewManager()->showTodoView();
460 } 460 }
461 if ( msg == "-showList" ) { 461 if ( msg == "-showList" ) {
462 mView->viewManager()->showListView(); 462 mView->viewManager()->showListView();
463 } 463 }
464 else if ( msg == "-showDay" ) { 464 else if ( msg == "-showDay" ) {
465 mView->viewManager()->showDayView(); 465 mView->viewManager()->showDayView();
466 } 466 }
467 else if ( msg == "-showWWeek" ) { 467 else if ( msg == "-showWWeek" ) {
468 mView->viewManager()->showWorkWeekView(); 468 mView->viewManager()->showWorkWeekView();
469 } 469 }
470 else if ( msg == "-ringSync" ) { 470 else if ( msg == "-ringSync" ) {
471 mSyncManager->multiSync( false ); 471 mSyncManager->multiSync( false );
472 } 472 }
473 else if ( msg == "-showWeek" ) { 473 else if ( msg == "-showWeek" ) {
474 mView->viewManager()->showWeekView(); 474 mView->viewManager()->showWeekView();
475 } 475 }
476 else if ( msg == "-showTodo" ) { 476 else if ( msg == "-showTodo" ) {
477 mView->viewManager()->showTodoView(); 477 mView->viewManager()->showTodoView();
478 } 478 }
479 else if ( msg == "-showJournal" ) { 479 else if ( msg == "-showJournal" ) {
480 mView->dateNavigator()->selectDates( 1 ); 480 mView->dateNavigator()->selectDates( 1 );
481 mView->dateNavigator()->selectToday(); 481 mView->dateNavigator()->selectToday();
482 mView->viewManager()->showJournalView(); 482 mView->viewManager()->showJournalView();
483 } 483 }
484 else if ( msg == "-showKO" ) { 484 else if ( msg == "-showKO" ) {
485 mView->viewManager()->showNextXView(); 485 mView->viewManager()->showNextXView();
486 } 486 }
487 else if ( msg == "-showWNext" ) { 487 else if ( msg == "-showWNext" ) {
488 mView->viewManager()->showWhatsNextView(); 488 mView->viewManager()->showWhatsNextView();
489 } 489 }
490 else if ( msg == "nextView()" ) { 490 else if ( msg == "nextView()" ) {
491 mView->viewManager()->showNextView(); 491 mView->viewManager()->showNextView();
492 } 492 }
493 else if ( msg == "-showNextXView" ) { 493 else if ( msg == "-showNextXView" ) {
494 mView->viewManager()->showNextXView(); 494 mView->viewManager()->showNextXView();
495 } 495 }
496 496
497 497
498 } 498 }
499 499
500 showMaximized(); 500 showMaximized();
501 raise(); 501 raise();
502} 502}
503 503
504QPixmap MainWindow::loadPixmap( QString name ) 504QPixmap MainWindow::loadPixmap( QString name )
505{ 505{
506 return SmallIcon( name ); 506 return SmallIcon( name );
507 507
508} 508}
509void MainWindow::initActions() 509void MainWindow::initActions()
510{ 510{
511 //KOPrefs::instance()->mShowFullMenu 511 //KOPrefs::instance()->mShowFullMenu
512 iconToolBar->clear(); 512 iconToolBar->clear();
513 KOPrefs *p = KOPrefs::instance(); 513 KOPrefs *p = KOPrefs::instance();
514 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 514 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
515 515
516 QPopupMenu *viewMenu = new QPopupMenu( this ); 516 QPopupMenu *viewMenu = new QPopupMenu( this );
517 QPopupMenu *actionMenu = new QPopupMenu( this ); 517 QPopupMenu *actionMenu = new QPopupMenu( this );
518 QPopupMenu *importMenu = new QPopupMenu( this ); 518 QPopupMenu *importMenu = new QPopupMenu( this );
519 QPopupMenu *importMenu_X = new QPopupMenu( this ); 519 QPopupMenu *importMenu_X = new QPopupMenu( this );
520 QPopupMenu *exportMenu_X = new QPopupMenu( this ); 520 QPopupMenu *exportMenu_X = new QPopupMenu( this );
521 QPopupMenu *beamMenu_X = new QPopupMenu( this ); 521 QPopupMenu *beamMenu_X = new QPopupMenu( this );
522 selectFilterMenu = new QPopupMenu( this ); 522 selectFilterMenu = new QPopupMenu( this );
523 selectFilterMenu->setCheckable( true ); 523 selectFilterMenu->setCheckable( true );
524 syncMenu = new QPopupMenu( this ); 524 syncMenu = new QPopupMenu( this );
525 configureAgendaMenu = new QPopupMenu( this ); 525 configureAgendaMenu = new QPopupMenu( this );
526 configureToolBarMenu = new QPopupMenu( this ); 526 configureToolBarMenu = new QPopupMenu( this );
527 QPopupMenu *helpMenu = new QPopupMenu( this ); 527 QPopupMenu *helpMenu = new QPopupMenu( this );
528 QIconSet icon; 528 QIconSet icon;
529 int pixWid = 22, pixHei = 22; 529 int pixWid = 22, pixHei = 22;
530 QString pathString = ""; 530 QString pathString = "";
531 if ( !p->mToolBarMiniIcons ) { 531 if ( !p->mToolBarMiniIcons ) {
532 if ( QApplication::desktop()->width() < 480 ) { 532 if ( QApplication::desktop()->width() < 480 ) {
533 pathString += "icons16/"; 533 pathString += "icons16/";
534 pixWid = 18; pixHei = 16; 534 pixWid = 18; pixHei = 16;
535 } 535 }
536 } else { 536 } else {
537 pathString += "iconsmini/"; 537 pathString += "iconsmini/";
538 pixWid = 18; pixHei = 16; 538 pixWid = 18; pixHei = 16;
539 } 539 }
540 if ( KOPrefs::instance()->mShowFullMenu ) { 540 if ( KOPrefs::instance()->mShowFullMenu ) {
541 QMenuBar *menuBar1; 541 QMenuBar *menuBar1;
542 menuBar1 = menuBar(); 542 menuBar1 = menuBar();
543 menuBar1->insertItem( i18n("File"), importMenu ); 543 menuBar1->insertItem( i18n("File"), importMenu );
544 menuBar1->insertItem( i18n("View"), viewMenu ); 544 menuBar1->insertItem( i18n("View"), viewMenu );
545 menuBar1->insertItem( i18n("Actions"), actionMenu ); 545 menuBar1->insertItem( i18n("Actions"), actionMenu );
546#ifdef DESKTOP_VERSION 546#ifdef DESKTOP_VERSION
547 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 547 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
548 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 548 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
549#else 549#else
550 menuBar1->insertItem( i18n("Sync"), syncMenu ); 550 menuBar1->insertItem( i18n("Sync"), syncMenu );
551 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu ); 551 menuBar1->insertItem( i18n("Agenda"),configureAgendaMenu );
552#endif 552#endif
553 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 553 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
554 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 554 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
555 menuBar1->insertItem( i18n("Help"), helpMenu ); 555 menuBar1->insertItem( i18n("Help"), helpMenu );
556 } else { 556 } else {
557 QPEMenuBar *menuBar1; 557 QPEMenuBar *menuBar1;
558 menuBar1 = new QPEMenuBar( iconToolBar ); 558 menuBar1 = new QPEMenuBar( iconToolBar );
559 QPopupMenu *menuBar = new QPopupMenu( this ); 559 QPopupMenu *menuBar = new QPopupMenu( this );
560 icon = loadPixmap( pathString + "z_menu" ); 560 icon = loadPixmap( pathString + "z_menu" );
561 menuBar1->insertItem( icon.pixmap(), menuBar); 561 menuBar1->insertItem( icon.pixmap(), menuBar);
562 //menuBar1->insertItem( i18n("ME"), menuBar); 562 //menuBar1->insertItem( i18n("ME"), menuBar);
563 menuBar->insertItem( i18n("File"), importMenu ); 563 menuBar->insertItem( i18n("File"), importMenu );
564 menuBar->insertItem( i18n("View"), viewMenu ); 564 menuBar->insertItem( i18n("View"), viewMenu );
565 menuBar->insertItem( i18n("Actions"), actionMenu ); 565 menuBar->insertItem( i18n("Actions"), actionMenu );
566 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 566 menuBar->insertItem( i18n("Synchronize"), syncMenu );
567 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 567 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
568 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 568 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
569 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 569 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
570 menuBar->insertItem( i18n("Help"), helpMenu ); 570 menuBar->insertItem( i18n("Help"), helpMenu );
571 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 571 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
572 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 572 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
573 } 573 }
574 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 574 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
575 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 575 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
576 mWeekBgColor = iconToolBar->backgroundColor(); 576 mWeekBgColor = iconToolBar->backgroundColor();
577 mWeekPixmap.resize( pixWid , pixHei ); 577 mWeekPixmap.resize( pixWid , pixHei );
578 mWeekPixmap.fill( mWeekBgColor ); 578 mWeekPixmap.fill( mWeekBgColor );
579 icon = mWeekPixmap; 579 icon = mWeekPixmap;
580 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this ); 580 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
581 if ( p-> mShowIconWeekNum ) 581 if ( p-> mShowIconWeekNum )
582 mWeekAction->addTo( iconToolBar ); 582 mWeekAction->addTo( iconToolBar );
583 mWeekFont = font(); 583 mWeekFont = font();
584 584
585 int fontPoint = mWeekFont.pointSize(); 585 int fontPoint = mWeekFont.pointSize();
586 QFontMetrics f( mWeekFont ); 586 QFontMetrics f( mWeekFont );
587 int fontWid = f.width( "30" ); 587 int fontWid = f.width( "30" );
588 while ( fontWid > pixWid ) { 588 while ( fontWid > pixWid ) {
589 --fontPoint; 589 --fontPoint;
590 mWeekFont.setPointSize( fontPoint ); 590 mWeekFont.setPointSize( fontPoint );
591 QFontMetrics f( mWeekFont ); 591 QFontMetrics f( mWeekFont );
592 fontWid = f.width( "30" ); 592 fontWid = f.width( "30" );
593 qDebug("dec-- "); 593 qDebug("dec-- ");
594 } 594 }
595 595
596 connect( mWeekAction, SIGNAL( activated() ), 596 connect( mWeekAction, SIGNAL( activated() ),
597 this, SLOT( weekAction() ) ); 597 this, SLOT( weekAction() ) );
598 598
599 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 599 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
600 600
601 //#endif 601 //#endif
602 // ****************** 602 // ******************
603 QAction *action; 603 QAction *action;
604 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 604 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
605 configureToolBarMenu->setCheckable( true ); 605 configureToolBarMenu->setCheckable( true );
606 606
607 607
608 configureAgendaMenu->setCheckable( true ); 608 configureAgendaMenu->setCheckable( true );
609 int iii ; 609 int iii ;
610 for ( iii = 1;iii<= 10 ;++iii ){ 610 for ( iii = 1;iii<= 10 ;++iii ){
611 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 ); 611 configureAgendaMenu->insertItem(i18n("Size %1").arg(iii), (iii+1)*2 );
612 } 612 }
613 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 613 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
614 614
615 connect( configureAgendaMenu, SIGNAL( aboutToShow()), 615 connect( configureAgendaMenu, SIGNAL( aboutToShow()),
616 this, SLOT( showConfigureAgenda( ) ) ); 616 this, SLOT( showConfigureAgenda( ) ) );
617 617
618 icon = loadPixmap( pathString + "configure" ); 618 icon = loadPixmap( pathString + "configure" );
619 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 619 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
620 action->addTo( actionMenu ); 620 action->addTo( actionMenu );
621 connect( action, SIGNAL( activated() ), 621 connect( action, SIGNAL( activated() ),
622 mView, SLOT( edit_options() ) ); 622 mView, SLOT( edit_options() ) );
623 actionMenu->insertSeparator(); 623 actionMenu->insertSeparator();
624 624
625 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this ); 625 action = new QAction( i18n("Undo Delete"), i18n("Undo Delete..."), 0, this );
626 action->addTo( actionMenu ); 626 action->addTo( actionMenu );
627 connect( action, SIGNAL( activated() ), 627 connect( action, SIGNAL( activated() ),
628 mView, SLOT( undo_delete() ) ); 628 mView, SLOT( undo_delete() ) );
629 actionMenu->insertSeparator(); 629 actionMenu->insertSeparator();
630 630
631 icon = loadPixmap( pathString + "newevent" ); 631 icon = loadPixmap( pathString + "newevent" );
632 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 632 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
633 configureToolBarMenu->insertSeparator(); 633 configureToolBarMenu->insertSeparator();
634 configureToolBarMenu->insertItem(i18n("Week Number"), 400); 634 configureToolBarMenu->insertItem(i18n("Week Number"), 400);
635 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 635 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
636 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 636 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
637 ne_action->addTo( actionMenu ); 637 ne_action->addTo( actionMenu );
638 connect( ne_action, SIGNAL( activated() ), 638 connect( ne_action, SIGNAL( activated() ),
639 mView, SLOT( newEvent() ) ); 639 mView, SLOT( newEvent() ) );
640 icon = loadPixmap( pathString + "newtodo" ); 640 icon = loadPixmap( pathString + "newtodo" );
641 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 641 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
642 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 642 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
643 nt_action->addTo( actionMenu ); 643 nt_action->addTo( actionMenu );
644 connect( nt_action, SIGNAL( activated() ), 644 connect( nt_action, SIGNAL( activated() ),
645 mView, SLOT( newTodo() ) ); 645 mView, SLOT( newTodo() ) );
646 646
647 icon = loadPixmap( pathString + "today" ); 647 icon = loadPixmap( pathString + "today" );
648 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 648 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
649 today_action->addTo( viewMenu ); 649 today_action->addTo( viewMenu );
650 connect( today_action, SIGNAL( activated() ), 650 connect( today_action, SIGNAL( activated() ),
651 mView, SLOT( goToday() ) ); 651 mView, SLOT( goToday() ) );
652 viewMenu->insertSeparator(); 652 viewMenu->insertSeparator();
653 653
654 icon = loadPixmap( pathString + "navi" ); 654 icon = loadPixmap( pathString + "navi" );
655 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 655 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
656 action->addTo( viewMenu ); 656 action->addTo( viewMenu );
657 connect( action, SIGNAL( activated() ), 657 connect( action, SIGNAL( activated() ),
658 mView, SLOT( toggleDateNavigatorWidget() ) ); 658 mView, SLOT( toggleDateNavigatorWidget() ) );
659 mToggleNav = action ; 659 mToggleNav = action ;
660 icon = loadPixmap( pathString + "filter" ); 660 icon = loadPixmap( pathString + "filter" );
661 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 661 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
662 action->addTo( viewMenu ); 662 action->addTo( viewMenu );
663 connect( action, SIGNAL( activated() ), 663 connect( action, SIGNAL( activated() ),
664 mView, SLOT( toggleFilter() ) ); 664 mView, SLOT( toggleFilter() ) );
665 mToggleFilter = action; 665 mToggleFilter = action;
666 icon = loadPixmap( pathString + "allday" ); 666 icon = loadPixmap( pathString + "allday" );
667 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this ); 667 action = new QAction( i18n("Toggle Allday"), icon,i18n("Toggle Allday"), 0, this );
668 action->addTo( viewMenu ); 668 action->addTo( viewMenu );
669 connect( action, SIGNAL( activated() ), 669 connect( action, SIGNAL( activated() ),
670 mView, SLOT( toggleAllDaySize() ) ); 670 mView, SLOT( toggleAllDaySize() ) );
671 mToggleAllday = action; 671 mToggleAllday = action;
672 672
673 673
674 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 674 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
675 mToggleNav, SLOT( setEnabled ( bool ) ) ); 675 mToggleNav, SLOT( setEnabled ( bool ) ) );
676 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ), 676 connect( mView->viewManager(), SIGNAL( signalFullScreen( bool ) ),
677 mToggleFilter, SLOT( setEnabled ( bool ) ) ); 677 mToggleFilter, SLOT( setEnabled ( bool ) ) );
678 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ), 678 connect( mView->viewManager(), SIGNAL( signalAgendaView( bool ) ),
679 mToggleAllday, SLOT( setEnabled ( bool ) ) ); 679 mToggleAllday, SLOT( setEnabled ( bool ) ) );
680 680
681 viewMenu->insertSeparator(); 681 viewMenu->insertSeparator();
682 icon = loadPixmap( pathString + "picker" ); 682 icon = loadPixmap( pathString + "picker" );
683 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 683 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
684 action->addTo( viewMenu ); 684 action->addTo( viewMenu );
685 connect( action, SIGNAL( activated() ), 685 connect( action, SIGNAL( activated() ),
686 mView, SLOT( showDatePicker() ) ); 686 mView, SLOT( showDatePicker() ) );
687 action->addTo( iconToolBar ); 687 action->addTo( iconToolBar );
688 viewMenu->insertSeparator(); 688 viewMenu->insertSeparator();
689 icon = loadPixmap( pathString + "list" ); 689
690 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 690
691 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 691 icon = loadPixmap( pathString + "whatsnext" );
692 showlist_action->addTo( viewMenu ); 692 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110 );
693 connect( showlist_action, SIGNAL( activated() ), 693 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
694 mView->viewManager(), SLOT( showListView() ) ); 694 whatsnext_action->addTo( viewMenu );
695 connect( whatsnext_action, SIGNAL( activated() ),
696 mView->viewManager(), SLOT( showWhatsNextView() ) );
697
698 icon = loadPixmap( pathString + "xdays" );
699 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100 );
700 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
701 xdays_action->addTo( viewMenu );
702 connect( xdays_action, SIGNAL( activated() ),
703 mView->viewManager(), SLOT( showNextXView() ) );
704
705
706 icon = loadPixmap( pathString + "journal" );
707 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
708 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
709 viewjournal_action->addTo( viewMenu );
710 connect( viewjournal_action, SIGNAL( activated() ),
711 mView->viewManager(), SLOT( showJournalView() ) );
695 712
696 713
697 icon = loadPixmap( pathString + "day" ); 714 icon = loadPixmap( pathString + "day" );
698 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 715 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
699 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 716 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
700 day1_action->addTo( viewMenu ); 717 day1_action->addTo( viewMenu );
701 // action->addTo( toolBar ); 718 // action->addTo( toolBar );
702 connect( day1_action, SIGNAL( activated() ), 719 connect( day1_action, SIGNAL( activated() ),
703 mView->viewManager(), SLOT( showDayView() ) ); 720 mView->viewManager(), SLOT( showDayView() ) );
704 721
705 icon = loadPixmap( pathString + "workweek" ); 722 icon = loadPixmap( pathString + "workweek" );
706 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 723 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
707 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 724 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
708 day5_action->addTo( viewMenu ); 725 day5_action->addTo( viewMenu );
709 connect( day5_action, SIGNAL( activated() ), 726 connect( day5_action, SIGNAL( activated() ),
710 mView->viewManager(), SLOT( showWorkWeekView() ) ); 727 mView->viewManager(), SLOT( showWorkWeekView() ) );
711 728
712 icon = loadPixmap( pathString + "week" ); 729 icon = loadPixmap( pathString + "week" );
713 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 730 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
714 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 731 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
715 day7_action->addTo( viewMenu ); 732 day7_action->addTo( viewMenu );
716 connect( day7_action, SIGNAL( activated() ), 733 connect( day7_action, SIGNAL( activated() ),
717 mView->viewManager(), SLOT( showWeekView() ) ); 734 mView->viewManager(), SLOT( showWeekView() ) );
718 735
719 icon = loadPixmap( pathString + "workweek2" ); 736 icon = loadPixmap( pathString + "workweek2" );
720 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 ); 737 configureToolBarMenu->insertItem(icon, i18n("List week view"), 75 );
721 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this ); 738 QAction* day6_action = new QAction( i18n("List week"), icon, i18n("List week"), 0, this );
722 day6_action->addTo( viewMenu ); 739 day6_action->addTo( viewMenu );
723 connect( day6_action, SIGNAL( activated() ), 740 connect( day6_action, SIGNAL( activated() ),
724 mView->viewManager(), SLOT( showMonthViewWeek() ) ); 741 mView->viewManager(), SLOT( showMonthViewWeek() ) );
725 742
726 icon = loadPixmap( pathString + "month" ); 743 icon = loadPixmap( pathString + "month" );
727 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 744 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
728 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 745 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
729 month_action->addTo( viewMenu ); 746 month_action->addTo( viewMenu );
730 connect( month_action, SIGNAL( activated() ), 747 connect( month_action, SIGNAL( activated() ),
731 mView->viewManager(), SLOT( showMonthView() ) ); 748 mView->viewManager(), SLOT( showMonthView() ) );
732 749
750 icon = loadPixmap( pathString + "list" );
751 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
752 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
753 showlist_action->addTo( viewMenu );
754 connect( showlist_action, SIGNAL( activated() ),
755 mView->viewManager(), SLOT( showListView() ) );
756
733 icon = loadPixmap( pathString + "todo" ); 757 icon = loadPixmap( pathString + "todo" );
734 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 758 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
735 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 759 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
736 todoview_action->addTo( viewMenu ); 760 todoview_action->addTo( viewMenu );
737 connect( todoview_action, SIGNAL( activated() ), 761 connect( todoview_action, SIGNAL( activated() ),
738 mView->viewManager(), SLOT( showTodoView() ) ); 762 mView->viewManager(), SLOT( showTodoView() ) );
739 763
740 icon = loadPixmap( pathString + "journal" );
741 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
742 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
743 viewjournal_action->addTo( viewMenu );
744 connect( viewjournal_action, SIGNAL( activated() ),
745 mView->viewManager(), SLOT( showJournalView() ) );
746
747 icon = loadPixmap( pathString + "xdays" );
748 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
749 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
750 xdays_action->addTo( viewMenu );
751 connect( xdays_action, SIGNAL( activated() ),
752 mView->viewManager(), SLOT( showNextXView() ) );
753 764
754 icon = loadPixmap( pathString + "whatsnext" );
755 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
756 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
757 whatsnext_action->addTo( viewMenu );
758 connect( whatsnext_action, SIGNAL( activated() ),
759 mView->viewManager(), SLOT( showWhatsNextView() ) );
760 765
761#if 0 766#if 0
762 action = new QAction( "view_timespan", "Time Span", 0, this ); 767 action = new QAction( "view_timespan", "Time Span", 0, this );
763 action->addTo( viewMenu ); 768 action->addTo( viewMenu );
764 connect( action, SIGNAL( activated() ), 769 connect( action, SIGNAL( activated() ),
765 mView->viewManager(), SLOT( showTimeSpanView() ) ); 770 mView->viewManager(), SLOT( showTimeSpanView() ) );
766#endif 771#endif
767 772
768 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 773 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
769 this ); 774 this );
770 mNewSubTodoAction->addTo( actionMenu ); 775 mNewSubTodoAction->addTo( actionMenu );
771 connect( mNewSubTodoAction, SIGNAL( activated() ), 776 connect( mNewSubTodoAction, SIGNAL( activated() ),
772 mView, SLOT( newSubTodo() ) ); 777 mView, SLOT( newSubTodo() ) );
773 778
774 actionMenu->insertSeparator(); 779 actionMenu->insertSeparator();
775 780
776 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 781 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
777 mShowAction->addTo( actionMenu ); 782 mShowAction->addTo( actionMenu );
778 connect( mShowAction, SIGNAL( activated() ), 783 connect( mShowAction, SIGNAL( activated() ),
779 mView, SLOT( showIncidence() ) ); 784 mView, SLOT( showIncidence() ) );
780 785
781 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 786 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
782 mEditAction->addTo( actionMenu ); 787 mEditAction->addTo( actionMenu );
783 connect( mEditAction, SIGNAL( activated() ), 788 connect( mEditAction, SIGNAL( activated() ),
784 mView, SLOT( editIncidence() ) ); 789 mView, SLOT( editIncidence() ) );
785 790
786 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 791 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
787 mDeleteAction->addTo( actionMenu ); 792 mDeleteAction->addTo( actionMenu );
788 connect( mDeleteAction, SIGNAL( activated() ), 793 connect( mDeleteAction, SIGNAL( activated() ),
789 mView, SLOT( deleteIncidence() ) ); 794 mView, SLOT( deleteIncidence() ) );
790 795
791 796
792 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this ); 797 mCloneAction = new QAction( "clone_incidence", i18n("Clone..."), 0, this );
793 mCloneAction->addTo( actionMenu ); 798 mCloneAction->addTo( actionMenu );
794 connect( mCloneAction, SIGNAL( activated() ), 799 connect( mCloneAction, SIGNAL( activated() ),
795 mView, SLOT( cloneIncidence() ) ); 800 mView, SLOT( cloneIncidence() ) );
796 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this ); 801 mMoveAction = new QAction( "Move_incidence", i18n("Move..."), 0, this );
797 mMoveAction->addTo( actionMenu ); 802 mMoveAction->addTo( actionMenu );
798 connect( mMoveAction, SIGNAL( activated() ), 803 connect( mMoveAction, SIGNAL( activated() ),
799 mView, SLOT( moveIncidence() ) ); 804 mView, SLOT( moveIncidence() ) );
800 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this ); 805 mBeamAction = new QAction( "Beam_incidence", i18n("Beam..."), 0, this );
801 mBeamAction->addTo( actionMenu ); 806 mBeamAction->addTo( actionMenu );
802 connect( mBeamAction, SIGNAL( activated() ), 807 connect( mBeamAction, SIGNAL( activated() ),
803 mView, SLOT( beamIncidence() ) ); 808 mView, SLOT( beamIncidence() ) );
804 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this ); 809 mCancelAction = new QAction( "Cancel_incidence", i18n("Toggle Cancel"), 0, this );
805 mCancelAction->addTo( actionMenu ); 810 mCancelAction->addTo( actionMenu );
806 connect( mCancelAction, SIGNAL( activated() ), 811 connect( mCancelAction, SIGNAL( activated() ),
807 mView, SLOT( toggleCancelIncidence() ) ); 812 mView, SLOT( toggleCancelIncidence() ) );
808 813
809 actionMenu->insertSeparator(); 814 actionMenu->insertSeparator();
810 815
811 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 816 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
812 this ); 817 this );
813 action->addTo( actionMenu ); 818 action->addTo( actionMenu );
814 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 819 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
815 820
816 icon = loadPixmap( pathString + "search" ); 821 icon = loadPixmap( pathString + "search" );
817 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 822 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
818 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 823 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 5);
819 search_action->addTo( actionMenu ); 824 search_action->addTo( actionMenu );
820 connect( search_action, SIGNAL( activated() ), 825 connect( search_action, SIGNAL( activated() ),
821 mView->dialogManager(), SLOT( showSearchDialog() ) ); 826 mView->dialogManager(), SLOT( showSearchDialog() ) );
822 827
823 828
824 829
825 if ( KOPrefs::instance()->mShowFullMenu ) { 830 if ( KOPrefs::instance()->mShowFullMenu ) {
826 actionMenu->insertSeparator(); 831 actionMenu->insertSeparator();
827 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 832 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
828 833
829 } 834 }
830 // actionMenu->insertSeparator(); 835 // actionMenu->insertSeparator();
831 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 836 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
832 this ); 837 this );
833 action->addTo( importMenu_X ); 838 action->addTo( importMenu_X );
834 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 839 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
835 action = new QAction( "import_quick", i18n("Import last file"), 0, 840 action = new QAction( "import_quick", i18n("Import last file"), 0,
836 this ); 841 this );
837 action->addTo( importMenu_X ); 842 action->addTo( importMenu_X );
838 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 843 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
839 importMenu_X->insertSeparator(); 844 importMenu_X->insertSeparator();
840 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 845 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
841 this ); 846 this );
842 action->addTo( importMenu_X ); 847 action->addTo( importMenu_X );
843 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 848 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
844 //#ifndef DESKTOP_VERSION 849 //#ifndef DESKTOP_VERSION
845 importMenu_X->insertSeparator(); 850 importMenu_X->insertSeparator();
846 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 851 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
847 this ); 852 this );
848 action->addTo( importMenu_X ); 853 action->addTo( importMenu_X );
849 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 854 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
850 //#else 855 //#else
851#ifdef _OL_IMPORT_ 856#ifdef _OL_IMPORT_
852 importMenu_X->insertSeparator(); 857 importMenu_X->insertSeparator();
853 action = new QAction( "import_ol", i18n("Import from OL"), 0, 858 action = new QAction( "import_ol", i18n("Import from OL"), 0,
854 this ); 859 this );
855 action->addTo( importMenu_X ); 860 action->addTo( importMenu_X );
856 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 861 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
857#endif 862#endif
858 //#endif 863 //#endif
859 864
860 //importMenu->insertSeparator(); 865 //importMenu->insertSeparator();
861 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 866 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
862 this ); 867 this );
863 action->addTo( importMenu ); 868 action->addTo( importMenu );
864 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 869 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
865 870
866 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 871 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
867 this ); 872 this );
868 action->addTo( importMenu ); 873 action->addTo( importMenu );
869 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 874 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
870 importMenu->insertSeparator(); 875 importMenu->insertSeparator();
871 importMenu->insertItem( i18n("Import"), importMenu_X ); 876 importMenu->insertItem( i18n("Import"), importMenu_X );
872 //importMenu->insertSeparator(); 877 //importMenu->insertSeparator();
873 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 878 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
874 this ); 879 this );
875 action->addTo( exportMenu_X ); 880 action->addTo( exportMenu_X );
876 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 881 connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
877 882
878 883
879 //LR 884 //LR
880 QPopupMenu *ex2phone = new QPopupMenu( this ); 885 QPopupMenu *ex2phone = new QPopupMenu( this );
881 ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 886 ex2phone->insertItem(i18n("Complete calendar..."), 1 );
882 ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 887 ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
883 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) ); 888 connect( ex2phone, SIGNAL( activated(int) ), this, SLOT( exportToPhone( int)) );
884 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone ); 889 exportMenu_X->insertItem( i18n("Export to phone"), ex2phone );
885 890
886 importMenu->insertItem( i18n("Export"), exportMenu_X ); 891 importMenu->insertItem( i18n("Export"), exportMenu_X );
887#ifndef DESKTOP_VERSION 892#ifndef DESKTOP_VERSION
888 //importMenu->insertSeparator(); 893 //importMenu->insertSeparator();
889 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0, 894 brAction = new QAction( "beam toggle", i18n("Beam receive enabled"), 0,
890 this ); 895 this );
891 brAction->addTo( beamMenu_X ); 896 brAction->addTo( beamMenu_X );
892 brAction->setToggleAction (true ) ; 897 brAction->setToggleAction (true ) ;
893 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) ); 898 connect( brAction, SIGNAL( activated() ), this, SLOT( toggleBeamReceive() ) );
894 899
895 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 900 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
896 this ); 901 this );
897 action->addTo( beamMenu_X ); 902 action->addTo( beamMenu_X );
898 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 903 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
899 904
900 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 905 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
901 this ); 906 this );
902 action->addTo( beamMenu_X ); 907 action->addTo( beamMenu_X );
903 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 908 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
904 importMenu->insertItem( i18n("Beam"), beamMenu_X ); 909 importMenu->insertItem( i18n("Beam"), beamMenu_X );
905#else 910#else
906 //importMenu->insertSeparator(); 911 //importMenu->insertSeparator();
907 icon = loadPixmap( pathString + "print" ); 912 icon = loadPixmap( pathString + "print" );
908 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 913 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
909 action->addTo( beamMenu_X ); 914 action->addTo( beamMenu_X );
910 connect( action, SIGNAL( activated() ), 915 connect( action, SIGNAL( activated() ),
911 this, SLOT( printCal() ) ); 916 this, SLOT( printCal() ) );
912 917
913 icon = loadPixmap( pathString + "print" ); 918 icon = loadPixmap( pathString + "print" );
914 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 919 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
915 action->addTo( beamMenu_X ); 920 action->addTo( beamMenu_X );
916 connect( action, SIGNAL( activated() ), 921 connect( action, SIGNAL( activated() ),
917 this, SLOT( printSel() ) ); 922 this, SLOT( printSel() ) );
918 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this ); 923 action = new QAction( i18n("Print What's Next View..."),icon,i18n("Print What's Next View..."), 0, this );
919 action->addTo( beamMenu_X ); 924 action->addTo( beamMenu_X );
920 connect( action, SIGNAL( activated() ), 925 connect( action, SIGNAL( activated() ),
921 mView->viewManager(), SIGNAL( printWNV() ) ); 926 mView->viewManager(), SIGNAL( printWNV() ) );
922 importMenu->insertItem( i18n("Print"), beamMenu_X ); 927 importMenu->insertItem( i18n("Print"), beamMenu_X );
923#endif 928#endif
924 importMenu->insertSeparator(); 929 importMenu->insertSeparator();
925 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 930 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
926 this ); 931 this );
927 action->addTo( importMenu ); 932 action->addTo( importMenu );
928 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 933 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
929 importMenu->insertSeparator(); 934 importMenu->insertSeparator();
930 action = new QAction( "beam all", i18n("Save"), 0, 935 action = new QAction( "beam all", i18n("Save"), 0,
931 this ); 936 this );
932 action->addTo( importMenu ); 937 action->addTo( importMenu );
933 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 938 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
934 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 939 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
935 this ); 940 this );
936 action->addTo( importMenu ); 941 action->addTo( importMenu );
937 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 942 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
938 943
939 //menuBar->insertItem( "Configure",configureMenu ); 944 //menuBar->insertItem( "Configure",configureMenu );
940 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 945 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
941 icon = loadPixmap( "korganizer/korganizer" ); 946 icon = loadPixmap( "korganizer/korganizer" );
942 947
943 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 948 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
944 action->addTo( helpMenu ); 949 action->addTo( helpMenu );
945 connect( action, SIGNAL( activated() ), 950 connect( action, SIGNAL( activated() ),
946 SLOT( whatsNew() ) ); 951 SLOT( whatsNew() ) );
947 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 952 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
948 action->addTo( helpMenu ); 953 action->addTo( helpMenu );
949 connect( action, SIGNAL( activated() ), 954 connect( action, SIGNAL( activated() ),
950 SLOT( features() ) ); 955 SLOT( features() ) );
951 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 956 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
952 action->addTo( helpMenu ); 957 action->addTo( helpMenu );
953 connect( action, SIGNAL( activated() ), 958 connect( action, SIGNAL( activated() ),
954 SLOT( keyBindings() ) ); 959 SLOT( keyBindings() ) );
955 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 960 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
956 action->addTo( helpMenu ); 961 action->addTo( helpMenu );
957 connect( action, SIGNAL( activated() ), 962 connect( action, SIGNAL( activated() ),
958 SLOT( synchowto() ) ); 963 SLOT( synchowto() ) );
959 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this ); 964 action = new QAction( "KDE Sync Howto", i18n("KDE Sync HowTo..."), 0,this );
960 action->addTo( helpMenu ); 965 action->addTo( helpMenu );
961 connect( action, SIGNAL( activated() ), 966 connect( action, SIGNAL( activated() ),
962 SLOT( kdesynchowto() ) ); 967 SLOT( kdesynchowto() ) );
963 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this ); 968 action = new QAction( "Multi Sync Howto", i18n("Multi Sync HowTo..."), 0,this );
964 action->addTo( helpMenu ); 969 action->addTo( helpMenu );
965 connect( action, SIGNAL( activated() ), 970 connect( action, SIGNAL( activated() ),
966 SLOT( multisynchowto() ) ); 971 SLOT( multisynchowto() ) );
967 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 972 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
968 action->addTo( helpMenu ); 973 action->addTo( helpMenu );
969 connect( action, SIGNAL( activated() ), 974 connect( action, SIGNAL( activated() ),
970 SLOT( aboutAutoSaving() ) ); 975 SLOT( aboutAutoSaving() ) );
971 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 976 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
972 action->addTo( helpMenu ); 977 action->addTo( helpMenu );
973 connect( action, SIGNAL( activated() ), 978 connect( action, SIGNAL( activated() ),
974 SLOT( aboutKnownBugs() ) ); 979 SLOT( aboutKnownBugs() ) );
975 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 980 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
976 action->addTo( helpMenu ); 981 action->addTo( helpMenu );
977 connect( action, SIGNAL( activated() ), 982 connect( action, SIGNAL( activated() ),
978 SLOT( usertrans() ) ); 983 SLOT( usertrans() ) );
979 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 984 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
980 action->addTo( helpMenu ); 985 action->addTo( helpMenu );
981 connect( action, SIGNAL( activated() ), 986 connect( action, SIGNAL( activated() ),
982 SLOT( faq() ) ); 987 SLOT( faq() ) );
983 action = new QAction( "licence", i18n("Licence..."), 0, this ); 988 action = new QAction( "licence", i18n("Licence..."), 0, this );
984 action->addTo( helpMenu ); 989 action->addTo( helpMenu );
985 connect( action, SIGNAL( activated() ), 990 connect( action, SIGNAL( activated() ),
986 SLOT( licence() ) ); 991 SLOT( licence() ) );
987 action = new QAction( "about", i18n("About..."), 0, this ); 992 action = new QAction( "about", i18n("About..."), 0, this );
988 action->addTo( helpMenu ); 993 action->addTo( helpMenu );
989 connect( action, SIGNAL( activated() ), 994 connect( action, SIGNAL( activated() ),
990 SLOT( about() ) ); 995 SLOT( about() ) );
991 //menuBar->insertSeparator(); 996 //menuBar->insertSeparator();
992 997
993 // ****************************************************** 998 // ******************************************************
994 // menubar icons 999 // menubar icons
995 1000
996 1001
997 iconToolBar->setHorizontalStretchable (true ); 1002 iconToolBar->setHorizontalStretchable (true );
998 //menuBar->insertItem( iconToolBar ); 1003 //menuBar->insertItem( iconToolBar );
999 //xdays_action 1004 //xdays_action
1000 if (p-> mShowIconNewEvent) 1005 if (p-> mShowIconNewEvent)
1001 ne_action->addTo( iconToolBar ); 1006 ne_action->addTo( iconToolBar );
1002 if (p->mShowIconNewTodo ) 1007 if (p->mShowIconNewTodo )
1003 nt_action->addTo( iconToolBar ); 1008 nt_action->addTo( iconToolBar );
1004 if (p-> mShowIconSearch) 1009 if (p-> mShowIconSearch)
1005 search_action->addTo( iconToolBar ); 1010 search_action->addTo( iconToolBar );
1006 if (p-> mShowIconWhatsThis) 1011 if (p-> mShowIconWhatsThis)
1007 QWhatsThis::whatsThisButton ( iconToolBar ); 1012 QWhatsThis::whatsThisButton ( iconToolBar );
1008 if (p-> mShowIconNext) 1013 if (p-> mShowIconNext)
1009 whatsnext_action->addTo( iconToolBar ); 1014 whatsnext_action->addTo( iconToolBar );
1010 if (p-> mShowIconNextDays) 1015 if (p-> mShowIconNextDays)
1011 xdays_action->addTo( iconToolBar ); 1016 xdays_action->addTo( iconToolBar );
1012 if (p-> mShowIconJournal) 1017 if (p-> mShowIconJournal)
1013 viewjournal_action->addTo( iconToolBar ); 1018 viewjournal_action->addTo( iconToolBar );
1014 if (p-> mShowIconDay1) 1019 if (p-> mShowIconDay1)
1015 day1_action->addTo( iconToolBar ); 1020 day1_action->addTo( iconToolBar );
1016 if (p-> mShowIconDay5) 1021 if (p-> mShowIconDay5)
1017 day5_action->addTo( iconToolBar ); 1022 day5_action->addTo( iconToolBar );
1018 if (p-> mShowIconDay7) 1023 if (p-> mShowIconDay7)
1019 day7_action->addTo( iconToolBar ); 1024 day7_action->addTo( iconToolBar );
1020 if (p-> mShowIconDay6) 1025 if (p-> mShowIconDay6)
1021 day6_action->addTo( iconToolBar ); 1026 day6_action->addTo( iconToolBar );
1022 if (p-> mShowIconMonth) 1027 if (p-> mShowIconMonth)
1023 month_action->addTo( iconToolBar ); 1028 month_action->addTo( iconToolBar );
1024 if (p-> mShowIconList) 1029 if (p-> mShowIconList)
1025 showlist_action->addTo( iconToolBar ); 1030 showlist_action->addTo( iconToolBar );
1026 if (p-> mShowIconTodoview) 1031 if (p-> mShowIconTodoview)
1027 todoview_action->addTo( iconToolBar ); 1032 todoview_action->addTo( iconToolBar );
1028 1033
1029 icon = loadPixmap( pathString + "2leftarrowB" ); 1034 icon = loadPixmap( pathString + "2leftarrowB" );
1030 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 1035 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200);
1031 if (p-> mShowIconBackFast) { 1036 if (p-> mShowIconBackFast) {
1032 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 1037 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
1033 connect( action, SIGNAL( activated() ), 1038 connect( action, SIGNAL( activated() ),
1034 mView, SLOT( goPreviousMonth() ) ); 1039 mView, SLOT( goPreviousMonth() ) );
1035 action->addTo( iconToolBar ); 1040 action->addTo( iconToolBar );
1036 } 1041 }
1037 icon = loadPixmap( pathString + "1leftarrowB" ); 1042 icon = loadPixmap( pathString + "1leftarrowB" );
1038 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 1043 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210);
1039 if (p-> mShowIconBack) { 1044 if (p-> mShowIconBack) {
1040 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 1045 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
1041 connect( action, SIGNAL( activated() ), 1046 connect( action, SIGNAL( activated() ),
1042 mView, SLOT( goPrevious() ) ); 1047 mView, SLOT( goPrevious() ) );
1043 action->addTo( iconToolBar ); 1048 action->addTo( iconToolBar );
1044 } 1049 }
1045 icon = loadPixmap( pathString + "today" ); 1050 icon = loadPixmap( pathString + "today" );
1046 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 1051 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
1047 if (p-> mShowIconToday) 1052 if (p-> mShowIconToday)
1048 today_action->addTo( iconToolBar ); 1053 today_action->addTo( iconToolBar );
1049 icon = loadPixmap( pathString + "1rightarrowB" ); 1054 icon = loadPixmap( pathString + "1rightarrowB" );
1050 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 1055 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
1051 if (p-> mShowIconForward) { 1056 if (p-> mShowIconForward) {
1052 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 1057 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
1053 connect( action, SIGNAL( activated() ), 1058 connect( action, SIGNAL( activated() ),
1054 mView, SLOT( goNext() ) ); 1059 mView, SLOT( goNext() ) );
1055 action->addTo( iconToolBar ); 1060 action->addTo( iconToolBar );
1056 } 1061 }
1057 icon = loadPixmap( pathString + "2rightarrowB" ); 1062 icon = loadPixmap( pathString + "2rightarrowB" );
1058 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 1063 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
1059 if (p-> mShowIconForwardFast) { 1064 if (p-> mShowIconForwardFast) {
1060 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 1065 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
1061 connect( action, SIGNAL( activated() ), 1066 connect( action, SIGNAL( activated() ),
1062 mView, SLOT( goNextMonth() ) ); 1067 mView, SLOT( goNextMonth() ) );
1063 action->addTo( iconToolBar ); 1068 action->addTo( iconToolBar );
1064 } 1069 }
1065 1070
1066 1071
1067 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 1072 configureToolBarMenu->insertItem(i18n("What's This?"), 300, 6);
1068 1073
1069 if (p-> mShowIconNewEvent) 1074 if (p-> mShowIconNewEvent)
1070 configureToolBarMenu->setItemChecked( 10, true ); 1075 configureToolBarMenu->setItemChecked( 10, true );
1071 if (p->mShowIconNewTodo ) 1076 if (p->mShowIconNewTodo )
1072 configureToolBarMenu->setItemChecked( 20, true ); 1077 configureToolBarMenu->setItemChecked( 20, true );
1073 if (p-> mShowIconSearch) 1078 if (p-> mShowIconSearch)
1074 configureToolBarMenu->setItemChecked( 120, true ); 1079 configureToolBarMenu->setItemChecked( 120, true );
1075 if (p-> mShowIconList) 1080 if (p-> mShowIconList)
1076 configureToolBarMenu->setItemChecked( 30, true ); 1081 configureToolBarMenu->setItemChecked( 30, true );
1077 if (p-> mShowIconDay1) 1082 if (p-> mShowIconDay1)
1078 configureToolBarMenu->setItemChecked( 40, true ); 1083 configureToolBarMenu->setItemChecked( 40, true );
1079 if (p-> mShowIconDay5) 1084 if (p-> mShowIconDay5)
1080 configureToolBarMenu->setItemChecked( 50, true ); 1085 configureToolBarMenu->setItemChecked( 50, true );
1081 if (p-> mShowIconDay6) 1086 if (p-> mShowIconDay6)
1082 configureToolBarMenu->setItemChecked( 75, true ); 1087 configureToolBarMenu->setItemChecked( 75, true );
1083 if (p-> mShowIconDay7) 1088 if (p-> mShowIconDay7)
1084 configureToolBarMenu->setItemChecked( 60, true ); 1089 configureToolBarMenu->setItemChecked( 60, true );
1085 if (p-> mShowIconMonth) 1090 if (p-> mShowIconMonth)
1086 configureToolBarMenu->setItemChecked( 70, true ); 1091 configureToolBarMenu->setItemChecked( 70, true );
1087 if (p-> mShowIconTodoview) 1092 if (p-> mShowIconTodoview)
1088 configureToolBarMenu->setItemChecked( 80, true ); 1093 configureToolBarMenu->setItemChecked( 80, true );
1089 if (p-> mShowIconBackFast) 1094 if (p-> mShowIconBackFast)
1090 configureToolBarMenu->setItemChecked( 200, true ); 1095 configureToolBarMenu->setItemChecked( 200, true );
1091 if (p-> mShowIconBack) 1096 if (p-> mShowIconBack)
1092 configureToolBarMenu->setItemChecked( 210, true ); 1097 configureToolBarMenu->setItemChecked( 210, true );
1093 if (p-> mShowIconToday) 1098 if (p-> mShowIconToday)
1094 configureToolBarMenu->setItemChecked( 130, true ); 1099 configureToolBarMenu->setItemChecked( 130, true );
1095 if (p-> mShowIconForward) 1100 if (p-> mShowIconForward)
1096 configureToolBarMenu->setItemChecked( 220, true ); 1101 configureToolBarMenu->setItemChecked( 220, true );
1097 if (p-> mShowIconForwardFast) 1102 if (p-> mShowIconForwardFast)
1098 configureToolBarMenu->setItemChecked( 230, true ); 1103 configureToolBarMenu->setItemChecked( 230, true );
1099 if (p-> mShowIconNextDays) 1104 if (p-> mShowIconNextDays)
1100 configureToolBarMenu->setItemChecked( 100, true ); 1105 configureToolBarMenu->setItemChecked( 100, true );
1101 if (p-> mShowIconNext) 1106 if (p-> mShowIconNext)
1102 configureToolBarMenu->setItemChecked( 110, true ); 1107 configureToolBarMenu->setItemChecked( 110, true );
1103 if (p-> mShowIconJournal) 1108 if (p-> mShowIconJournal)
1104 configureToolBarMenu->setItemChecked( 90, true ); 1109 configureToolBarMenu->setItemChecked( 90, true );
1105 if (p-> mShowIconWhatsThis) 1110 if (p-> mShowIconWhatsThis)
1106 configureToolBarMenu->setItemChecked( 300, true ); 1111 configureToolBarMenu->setItemChecked( 300, true );
1107 if (p-> mShowIconWeekNum) 1112 if (p-> mShowIconWeekNum)
1108 configureToolBarMenu->setItemChecked( 400, true ); 1113 configureToolBarMenu->setItemChecked( 400, true );
1109 QLabel* dummy = new QLabel( iconToolBar ); 1114 QLabel* dummy = new QLabel( iconToolBar );
1110 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 1115 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
1111 if (!p-> mShowIconStretch) 1116 if (!p-> mShowIconStretch)
1112 iconToolBar->setStretchableWidget ( dummy ) ; 1117 iconToolBar->setStretchableWidget ( dummy ) ;
1113 else 1118 else
1114 configureToolBarMenu->setItemChecked( 5, true ); 1119 configureToolBarMenu->setItemChecked( 5, true );
1115 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 1120 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
1116 configureAgenda( p->mHourSize ); 1121 configureAgenda( p->mHourSize );
1117 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 1122 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
1118} 1123}
1119 1124
1120void MainWindow::exportToPhone( int mode ) 1125void MainWindow::exportToPhone( int mode )
1121{ 1126{
1122 1127
1123 //ex2phone->insertItem(i18n("Complete calendar..."), 1 ); 1128 //ex2phone->insertItem(i18n("Complete calendar..."), 1 );
1124 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 ); 1129 //ex2phone->insertItem(i18n("Filtered calendar..."), 2 );
1125 KOex2phonePrefs ex2phone; 1130 KOex2phonePrefs ex2phone;
1126 1131
1127 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection ); 1132 ex2phone.mPhoneConnection->setText( KPimGlobalPrefs::instance()->mEx2PhoneConnection );
1128 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice ); 1133 ex2phone.mPhoneDevice->setText( KPimGlobalPrefs::instance()->mEx2PhoneDevice );
1129 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1134 ex2phone.mPhoneModel->setText( KPimGlobalPrefs::instance()->mEx2PhoneModel );
1130 if ( mode == 1 ) 1135 if ( mode == 1 )
1131 ex2phone.setCaption(i18n("Export complete calendar")); 1136 ex2phone.setCaption(i18n("Export complete calendar"));
1132 if ( mode == 2 ) 1137 if ( mode == 2 )
1133 ex2phone.setCaption(i18n("Export filtered calendar")); 1138 ex2phone.setCaption(i18n("Export filtered calendar"));
1134 1139
1135 if ( !ex2phone.exec() ) { 1140 if ( !ex2phone.exec() ) {
1136 return; 1141 return;
1137 } 1142 }
1138 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text(); 1143 KPimGlobalPrefs::instance()->mEx2PhoneConnection = ex2phone.mPhoneConnection->text();
1139 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text(); 1144 KPimGlobalPrefs::instance()->mEx2PhoneDevice = ex2phone.mPhoneDevice->text();
1140 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text(); 1145 KPimGlobalPrefs::instance()->mEx2PhoneModel = ex2phone.mPhoneModel->text();
1141 1146
1142 int inFuture = 0; 1147 int inFuture = 0;
1143 if ( ex2phone.mWriteBackFuture->isChecked() ) 1148 if ( ex2phone.mWriteBackFuture->isChecked() )
1144 inFuture = ex2phone.mWriteBackFutureWeeks->value(); 1149 inFuture = ex2phone.mWriteBackFutureWeeks->value();
1145 QPtrList<Incidence> delSel; 1150 QPtrList<Incidence> delSel;
1146 if ( mode == 1 ) 1151 if ( mode == 1 )
1147 delSel = mCalendar->rawIncidences(); 1152 delSel = mCalendar->rawIncidences();
1148 if ( mode == 2 ) 1153 if ( mode == 2 )
1149 delSel = mCalendar->incidences(); 1154 delSel = mCalendar->incidences();
1150 CalendarLocal* cal = new CalendarLocal(); 1155 CalendarLocal* cal = new CalendarLocal();
1151 cal->setLocalTime(); 1156 cal->setLocalTime();
1152 Incidence *incidence = delSel.first(); 1157 Incidence *incidence = delSel.first();
1153 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1158 QDateTime cur = QDateTime::currentDateTime().addDays( -7 );
1154 QDateTime end = cur.addDays( ( inFuture +1 ) *7 ); 1159 QDateTime end = cur.addDays( ( inFuture +1 ) *7 );
1155 while ( incidence ) { 1160 while ( incidence ) {
1156 if ( incidence->type() != "Journal" ) { 1161 if ( incidence->type() != "Journal" ) {
1157 bool add = true; 1162 bool add = true;
1158 if ( inFuture ) { 1163 if ( inFuture ) {
1159 QDateTime dt; 1164 QDateTime dt;
1160 if ( incidence->type() == "Todo" ) { 1165 if ( incidence->type() == "Todo" ) {
1161 Todo * t = (Todo*)incidence; 1166 Todo * t = (Todo*)incidence;
1162 if ( t->hasDueDate() ) 1167 if ( t->hasDueDate() )
1163 dt = t->dtDue(); 1168 dt = t->dtDue();
1164 else 1169 else
1165 dt = cur.addSecs( 62 ); 1170 dt = cur.addSecs( 62 );
1166 } 1171 }
1167 else { 1172 else {
1168 bool ok; 1173 bool ok;
1169 dt = incidence->getNextOccurence( cur, &ok ); 1174 dt = incidence->getNextOccurence( cur, &ok );
1170 if ( !ok ) 1175 if ( !ok )
1171 dt = cur.addSecs( -62 ); 1176 dt = cur.addSecs( -62 );
1172 } 1177 }
1173 if ( dt < cur || dt > end ) { 1178 if ( dt < cur || dt > end ) {
1174 add = false; 1179 add = false;
1175 } 1180 }
1176 } 1181 }
1177 if ( add ) { 1182 if ( add ) {
1178 Incidence *in = incidence->clone(); 1183 Incidence *in = incidence->clone();
1179 cal->addIncidence( in ); 1184 cal->addIncidence( in );
1180 } 1185 }
1181 } 1186 }
1182 incidence = delSel.next(); 1187 incidence = delSel.next();
1183 } 1188 }
1184 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice, 1189 PhoneAccess::writeConfig( KPimGlobalPrefs::instance()->mEx2PhoneDevice,
1185 KPimGlobalPrefs::instance()->mEx2PhoneConnection, 1190 KPimGlobalPrefs::instance()->mEx2PhoneConnection,
1186 KPimGlobalPrefs::instance()->mEx2PhoneModel ); 1191 KPimGlobalPrefs::instance()->mEx2PhoneModel );
1187 1192
1188 setCaption( i18n("Writing to phone...")); 1193 setCaption( i18n("Writing to phone..."));
1189 if ( PhoneFormat::writeToPhone( cal ) ) 1194 if ( PhoneFormat::writeToPhone( cal ) )
1190 setCaption( i18n("Export to phone successful!")); 1195 setCaption( i18n("Export to phone successful!"));
1191 else 1196 else
1192 setCaption( i18n("Error exporting to phone!")); 1197 setCaption( i18n("Error exporting to phone!"));
1193 delete cal; 1198 delete cal;
1194} 1199}
1195 1200
1196 1201
1197void MainWindow::setDefaultPreferences() 1202void MainWindow::setDefaultPreferences()
1198{ 1203{
1199 KOPrefs *p = KOPrefs::instance(); 1204 KOPrefs *p = KOPrefs::instance();
1200 1205
1201 p->mCompactDialogs = true; 1206 p->mCompactDialogs = true;
1202 p->mConfirm = true; 1207 p->mConfirm = true;
1203 // p->mEnableQuickTodo = false; 1208 // p->mEnableQuickTodo = false;
1204 1209
1205} 1210}
1206 1211
1207QString MainWindow::resourcePath() 1212QString MainWindow::resourcePath()
1208{ 1213{
1209 return KGlobal::iconLoader()->iconPath(); 1214 return KGlobal::iconLoader()->iconPath();
1210} 1215}
1211 1216
1212void MainWindow::displayText( QString text ,QString cap ) 1217void MainWindow::displayText( QString text ,QString cap )
1213{ 1218{
1214 QDialog dia( this, "name", true ); ; 1219 QDialog dia( this, "name", true ); ;
1215 dia.setCaption( cap ); 1220 dia.setCaption( cap );
1216 QVBoxLayout* lay = new QVBoxLayout( &dia ); 1221 QVBoxLayout* lay = new QVBoxLayout( &dia );
1217 lay->setSpacing( 3 ); 1222 lay->setSpacing( 3 );
1218 lay->setMargin( 3 ); 1223 lay->setMargin( 3 );
1219 QTextBrowser tb ( &dia ); 1224 QTextBrowser tb ( &dia );
1220 lay->addWidget( &tb ); 1225 lay->addWidget( &tb );
1221 tb.setText( text ); 1226 tb.setText( text );
1222#ifdef DESKTOP_VERSION 1227#ifdef DESKTOP_VERSION
1223 dia.resize( 640, 480); 1228 dia.resize( 640, 480);
1224#else 1229#else
1225 dia.showMaximized(); 1230 dia.showMaximized();
1226#endif 1231#endif
1227 dia.exec(); 1232 dia.exec();
1228} 1233}
1229 1234
1230void MainWindow::features() 1235void MainWindow::features()
1231{ 1236{
1232 1237
1233 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" ); 1238 KApplication::showFile( i18n("KO/Pi Features and hints"), "kdepim/korganizer/featuresKOPI.txt" );
1234} 1239}
1235 1240
1236void MainWindow::usertrans() 1241void MainWindow::usertrans()
1237{ 1242{
1238 1243
1239 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" ); 1244 KApplication::showFile( i18n("KO/Pi User translation HowTo"), "kdepim/korganizer/usertranslationHOWTO.txt" );
1240} 1245}
1241 1246
1242void MainWindow::kdesynchowto() 1247void MainWindow::kdesynchowto()
1243{ 1248{
1244 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" ); 1249 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/Zaurus-KDE_syncHowTo.txt" );
1245} 1250}
1246void MainWindow::multisynchowto() 1251void MainWindow::multisynchowto()
1247{ 1252{
1248 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" ); 1253 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/MultiSyncHowTo.txt" );
1249} 1254}
1250void MainWindow::synchowto() 1255void MainWindow::synchowto()
1251{ 1256{
1252 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" ); 1257 KApplication::showFile( "KDE-Pim/Pi Synchronization HowTo", "kdepim/SyncHowto.txt" );
1253} 1258}
1254void MainWindow::faq() 1259void MainWindow::faq()
1255{ 1260{
1256 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" ); 1261 KApplication::showFile( i18n("KO/Pi FAQ"), "kdepim/korganizer/kopiFAQ.txt" );
1257 1262
1258} 1263}
1259void MainWindow::whatsNew() 1264void MainWindow::whatsNew()
1260{ 1265{
1261 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" ); 1266 KApplication::showFile( "KDE-Pim/Pi Version Info", "kdepim/WhatsNew.txt" );
1262 1267
1263} 1268}
1264void MainWindow::licence() 1269void MainWindow::licence()
1265{ 1270{
1266 KApplication::showLicence(); 1271 KApplication::showLicence();
1267 1272
1268} 1273}
1269void MainWindow::about() 1274void MainWindow::about()
1270{ 1275{
1271 QString version; 1276 QString version;
1272#include <../version> 1277#include <../version>
1273 QMessageBox::about( this, i18n("About KOrganizer/Pi"), 1278 QMessageBox::about( this, i18n("About KOrganizer/Pi"),
1274 i18n("KOrganizer/Platform-independent\n") + 1279 i18n("KOrganizer/Platform-independent\n") +
1275 "(KO/Pi) " + version + " - " + 1280 "(KO/Pi) " + version + " - " +
1276 1281
1277#ifdef DESKTOP_VERSION 1282#ifdef DESKTOP_VERSION
1278 i18n("Desktop Edition\n") + 1283 i18n("Desktop Edition\n") +
1279#else 1284#else
1280 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") + 1285 i18n("PDA-Edition\nfor: Zaurus 5x00/7x0/860/3000/6000\n") +
1281#endif 1286#endif
1282 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!") ); 1287 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!") );
1283} 1288}
1284void MainWindow::keyBindings() 1289void MainWindow::keyBindings()
1285{ 1290{
1286 QString cap = i18n("KO/Pi Keys + Colors"); 1291 QString cap = i18n("KO/Pi Keys + Colors");
1287 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") + 1292 QString text = i18n("<p><h2>KO/Pi key shortcuts:</h2></p>\n") +
1288 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+ 1293 i18n("<p><b>H</b>: This help dialog | <b>S</b>: Search dialog</p>\n")+
1289 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") + 1294 i18n("<p><b>I</b>: Show info for selected event/todo</p>\n") +
1290 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+ 1295 i18n("<p><b>Space</b>: Toggle fullscreen | <b>P</b>: Date picker</p>\n")+
1291 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+ 1296 i18n("<p><b>F</b>: Toggle filterview |<b>F+ctrl</b>: Edit filter </p>\n")+
1292 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+ 1297 i18n("<p><b>O</b>: Filter On/Off | <b>J</b>: Journal view</p>\n")+
1293 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+ 1298 i18n("<p><b>1-0</b> (+<b>ctrl</b>): Select filter 1-10 (11-20)</p>\n")+
1294 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+ 1299 i18n("<p><b>N</b>: Next days view| <b>W</b>: What's next view\n ")+
1295 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+ 1300 i18n("<p><b>V</b>: Todo view | <b>L</b>: Event list view</p>\n")+
1296 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+ 1301 i18n("<p><b>Z,Y</b>: Work week view | <b>U</b>: Week view</p>\n")+
1297 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+ 1302 i18n("<p><b>D</b>: One day view | <b>M</b>: Month view</p>\n")+
1298 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+ 1303 i18n("<p><b>K</b>: Week view in Month view syle</p>\n")+
1299 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+ 1304 i18n("<p><b>E</b>: Edit selected item |<b> E+ctrl</b>: New Event</p>\n")+
1300 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+ 1305 i18n("<p><b>T</b>: Goto today | <b>T+ctrl</b>: New Todo</p>\n")+
1301 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+ 1306 i18n("<p><b>S+ctrl</b>: Add sub-todo | <b>X</b>: Toggle datenavigator</p>\n")+
1302 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+ 1307 i18n("<p><b>+,-</b> : Zoom in/out agenda | <b>A</b>: Toggle allday agenda height</p>\n")+
1303 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+ 1308 i18n("<p><b>C</b>: Show current time in agenda view</p>\n")+
1304 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+ 1309 i18n("<p><b>B</b>: Edit description (details) of selected item</p>\n")+
1305 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+ 1310 i18n("<p><b>right</b>: Next week | <b>right+ctrl</b>: Next month</p>\n")+
1306 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+ 1311 i18n("<p><b>left</b>: Prev. week | <b>left+ctrl</b>: Prev. month</p>\n")+
1307 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+ 1312 i18n("<p><b>del,backspace</b>: Delete selected item</p>\n")+
1308 i18n("<p><h3>In agenda view:</h3></p>\n") + 1313 i18n("<p><h3>In agenda view:</h3></p>\n") +
1309 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+ 1314 i18n("<p><b>up/down</b>: Scroll agenda view</p>\n")+
1310 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+ 1315 i18n("<p><b>ctrl+up/down</b>: Scroll small todo view</p>\n")+
1311 i18n("<p><h3>In todo view:</h3></p>\n") + 1316 i18n("<p><h3>In todo view:</h3></p>\n") +
1312 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+ 1317 i18n("<p><b>shift+U</b>: <b>U</b>nparent todo (make root todo)</p>\n")+
1313 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+ 1318 i18n("<p><b>shift+S</b>: Make <b>S</b>ubtodo (reparent todo)</p>\n")+
1314 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+ 1319 i18n("<p><b>shift+P</b>: Make new <b>P</b>arent for todo selected with shift+S</p>\n")+
1315 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+ 1320 i18n("<p><b>Q</b>: Toggle quick todo line edit.</p>\n")+
1316 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1321 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1317 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+ 1322 i18n("<p><b>return</b>: Mark item as completed+one step down.</p>\n")+
1318 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+ 1323 i18n("<p><b>return+shift</b>: Mark item as not completed+one step down</p>\n")+
1319 i18n("<p><h3>In list view:</h3></p>\n") + 1324 i18n("<p><h3>In list view:</h3></p>\n") +
1320 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+ 1325 i18n("<p><b>I</b>: Show info of current item+one step down.</p>\n")+
1321 i18n("<p><b>return</b>: Select item+one step down</p>\n")+ 1326 i18n("<p><b>return</b>: Select item+one step down</p>\n")+
1322 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+ 1327 i18n("<p><b>return+shift</b>: Deselect item+one step down</p>\n")+
1323 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+ 1328 i18n("<p><b>up/down</b>: Next/prev item</p>\n")+
1324 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+ 1329 i18n("<p><b>ctrl+up/down</b>: Goto up/down by 20% of items</p>\n")+
1325 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+ 1330 i18n("<p><b>shift+up/down</b>: Goto first/last item</p>\n")+
1326 i18n("<p><h3>In event/todo viewer:</h3></p>\n") + 1331 i18n("<p><h3>In event/todo viewer:</h3></p>\n") +
1327 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+ 1332 i18n("<p><b>I,C</b>: Close dialog.</p>\n")+
1328 i18n("<p><b>A</b>: Show agenda view.</p>\n")+ 1333 i18n("<p><b>A</b>: Show agenda view.</p>\n")+
1329 i18n("<p><b>E</b>: Edit item</p>\n") + 1334 i18n("<p><b>E</b>: Edit item</p>\n") +
1330 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") + 1335 i18n("<p><h2>KO/Pi icon colors:</h2></p>\n") +
1331 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") + 1336 i18n("<p><b>(for square icons in agenda and month view)</b></p>\n") +
1332 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+ 1337 i18n("<p><b>Cross</b>: Item cancelled.([c] in Whats'Next view)</p>\n")+
1333 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+ 1338 i18n("<p><b>Red</b>: Alarm set.([a] in Whats'Next view)</p>\n")+
1334 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+ 1339 i18n("<p><b>Blue</b>: Recurrent event.([r] in Whats'Next view)</p>\n")+
1335 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+ 1340 i18n("<p><b>Dark green</b>: Information(description) available.([i] in WN view)</p>\n")+
1336 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+ 1341 i18n("<p><b>Black</b>: Event/todo with attendees. You are the organizer!</p>\n")+
1337 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") + 1342 i18n("<p><b>Dark yellow</b>: Event/todo with attendees.</p>\n") +
1338 i18n("<p><b>White</b>: Item readonly</p>\n"); 1343 i18n("<p><b>White</b>: Item readonly</p>\n");
1339 displayText( text, cap); 1344 displayText( text, cap);
1340} 1345}
1341void MainWindow::aboutAutoSaving() 1346void MainWindow::aboutAutoSaving()
1342{ 1347{
1343 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"); 1348 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");
1344 1349
1345 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1350 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1346 1351
1347} 1352}
1348void MainWindow::aboutKnownBugs() 1353void MainWindow::aboutKnownBugs()
1349{ 1354{
1350 QMessageBox* msg; 1355 QMessageBox* msg;
1351 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1356 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1352 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")+ 1357 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")+
1353 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1358 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1354 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") + 1359 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.info\n") +
1355 i18n("\nor report them in the bugtracker on\n") + 1360 i18n("\nor report them in the bugtracker on\n") +
1356 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1361 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1357 QMessageBox::NoIcon, 1362 QMessageBox::NoIcon,
1358 QMessageBox::Ok, 1363 QMessageBox::Ok,
1359 QMessageBox::NoButton, 1364 QMessageBox::NoButton,
1360 QMessageBox::NoButton); 1365 QMessageBox::NoButton);
1361 msg->exec(); 1366 msg->exec();
1362 delete msg; 1367 delete msg;
1363 1368
1364} 1369}
1365 1370
1366QString MainWindow::defaultFileName() 1371QString MainWindow::defaultFileName()
1367{ 1372{
1368 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1373 return locateLocal( "data", "korganizer/mycalendar.ics" );
1369} 1374}
1370QString MainWindow::syncFileName() 1375QString MainWindow::syncFileName()
1371{ 1376{
1372#ifdef DESKTOP_VERSION 1377#ifdef DESKTOP_VERSION
1373 return locateLocal( "tmp", "synccalendar.ics" ); 1378 return locateLocal( "tmp", "synccalendar.ics" );
1374#else 1379#else
1375 return QString( "/tmp/synccalendar.ics" ); 1380 return QString( "/tmp/synccalendar.ics" );
1376#endif 1381#endif
1377} 1382}
1378void MainWindow::updateWeek(QDate seda) 1383void MainWindow::updateWeek(QDate seda)
1379{ 1384{
1380 int weekNum = 0; 1385 int weekNum = 0;
1381 QDate d = QDate ( seda.year(), 1,1); 1386 QDate d = QDate ( seda.year(), 1,1);
1382 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday 1387 seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday
1383 if ( seda.addDays(6).year() != seda.year() ) { 1388 if ( seda.addDays(6).year() != seda.year() ) {
1384 if ( seda.year() != d.year() ) { 1389 if ( seda.year() != d.year() ) {
1385 if ( d.dayOfWeek() > 4 ) 1390 if ( d.dayOfWeek() > 4 )
1386 d = QDate ( seda.year(), 1,1); 1391 d = QDate ( seda.year(), 1,1);
1387 else 1392 else
1388 weekNum = 1; 1393 weekNum = 1;
1389 } else { 1394 } else {
1390 QDate dd( seda.year()+1, 1,1); 1395 QDate dd( seda.year()+1, 1,1);
1391 if ( dd.dayOfWeek() <= 4 ) 1396 if ( dd.dayOfWeek() <= 4 )
1392 weekNum = 1; 1397 weekNum = 1;
1393 } 1398 }
1394 } 1399 }
1395 if ( weekNum == 0 ){ 1400 if ( weekNum == 0 ){
1396 int dow = d.dayOfWeek(); 1401 int dow = d.dayOfWeek();
1397 if ( dow <= 4 ) 1402 if ( dow <= 4 )
1398 d = d.addDays( 1-dow ); 1403 d = d.addDays( 1-dow );
1399 else // 5,6,7 1404 else // 5,6,7
1400 d = d.addDays( 8-dow ); 1405 d = d.addDays( 8-dow );
1401 // we have the first week of the year.we are on monday 1406 // we have the first week of the year.we are on monday
1402 weekNum = d.daysTo( seda ) / 7 +1; 1407 weekNum = d.daysTo( seda ) / 7 +1;
1403 } 1408 }
1404 1409
1405 mWeekPixmap.fill( mWeekBgColor ); 1410 mWeekPixmap.fill( mWeekBgColor );
1406 QPainter p ( &mWeekPixmap ); 1411 QPainter p ( &mWeekPixmap );
1407 p.setFont( mWeekFont ); 1412 p.setFont( mWeekFont );
1408 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) ); 1413 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1409 p.end(); 1414 p.end();
1410 QIconSet icon3 ( mWeekPixmap ); 1415 QIconSet icon3 ( mWeekPixmap );
1411 mWeekAction->setIconSet ( icon3 ); 1416 mWeekAction->setIconSet ( icon3 );
1412 1417
1413} 1418}
1414void MainWindow::updateWeekNum(const DateList &selectedDates) 1419void MainWindow::updateWeekNum(const DateList &selectedDates)
1415{ 1420{
1416 updateWeek( selectedDates.first() ); 1421 updateWeek( selectedDates.first() );
1417} 1422}
1418void MainWindow::processIncidenceSelection( Incidence *incidence ) 1423void MainWindow::processIncidenceSelection( Incidence *incidence )
1419{ 1424{
1420 1425
1421 if ( !incidence ) { 1426 if ( !incidence ) {
1422 enableIncidenceActions( false ); 1427 enableIncidenceActions( false );
1423 1428
1424 mNewSubTodoAction->setEnabled( false ); 1429 mNewSubTodoAction->setEnabled( false );
1425 setCaptionToDates(); 1430 setCaptionToDates();
1426 return; 1431 return;
1427 1432
1428 } 1433 }
1429 1434
1430 //KGlobal::locale()->formatDateTime(nextA, true); 1435 //KGlobal::locale()->formatDateTime(nextA, true);
1431 QString startString = ""; 1436 QString startString = "";
1432 if ( incidence->type() != "Todo" ) { 1437 if ( incidence->type() != "Todo" ) {
1433 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1438 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1434 if ( incidence->doesFloat() ) { 1439 if ( incidence->doesFloat() ) {
1435 startString += ": "+incidence->dtStartDateStr( true ); 1440 startString += ": "+incidence->dtStartDateStr( true );
1436 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1441 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1437 1442
1438 } else { 1443 } else {
1439 startString = ": "+incidence->dtStartStr(true); 1444 startString = ": "+incidence->dtStartStr(true);
1440 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1445 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1441 1446
1442 } 1447 }
1443 1448
1444 } else { 1449 } else {
1445 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1450 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1446 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1451 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1447 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1452 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1448 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) { 1453 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1449 bool ok; 1454 bool ok;
1450 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok ); 1455 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1451 if ( ok ) { 1456 if ( ok ) {
1452 int years = noc.date().year() - incidence->dtStart().date().year(); 1457 int years = noc.date().year() - incidence->dtStart().date().year();
1453 startString += i18n(" (%1 y.)"). arg( years ); 1458 startString += i18n(" (%1 y.)"). arg( years );
1454 } 1459 }
1455 } 1460 }
1456 else 1461 else
1457 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1462 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1458 } 1463 }
1459 1464
1460 } 1465 }
1461 else 1466 else
1462 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1467 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1463 if ( !incidence->location().isEmpty() ) 1468 if ( !incidence->location().isEmpty() )
1464 startString += " (" +incidence->location()+")"; 1469 startString += " (" +incidence->location()+")";
1465 setCaption( incidence->summary()+startString); 1470 setCaption( incidence->summary()+startString);
1466 1471
1467 enableIncidenceActions( true ); 1472 enableIncidenceActions( true );
1468 1473
1469 if ( incidence->type() == "Event" ) { 1474 if ( incidence->type() == "Event" ) {
1470 mShowAction->setText( i18n("Show Event...") ); 1475 mShowAction->setText( i18n("Show Event...") );
1471 mEditAction->setText( i18n("Edit Event...") ); 1476 mEditAction->setText( i18n("Edit Event...") );
1472 mDeleteAction->setText( i18n("Delete Event...") ); 1477 mDeleteAction->setText( i18n("Delete Event...") );
1473 1478
1474 mNewSubTodoAction->setEnabled( false ); 1479 mNewSubTodoAction->setEnabled( false );
1475 } else if ( incidence->type() == "Todo" ) { 1480 } else if ( incidence->type() == "Todo" ) {
1476 mShowAction->setText( i18n("Show Todo...") ); 1481 mShowAction->setText( i18n("Show Todo...") );
1477 mEditAction->setText( i18n("Edit Todo...") ); 1482 mEditAction->setText( i18n("Edit Todo...") );
1478 mDeleteAction->setText( i18n("Delete Todo...") ); 1483 mDeleteAction->setText( i18n("Delete Todo...") );
1479 1484
1480 mNewSubTodoAction->setEnabled( true ); 1485 mNewSubTodoAction->setEnabled( true );
1481 } else { 1486 } else {
1482 mShowAction->setText( i18n("Show...") ); 1487 mShowAction->setText( i18n("Show...") );
1483 mShowAction->setText( i18n("Edit...") ); 1488 mShowAction->setText( i18n("Edit...") );
1484 mShowAction->setText( i18n("Delete...") ); 1489 mShowAction->setText( i18n("Delete...") );
1485 1490
1486 mNewSubTodoAction->setEnabled( false ); 1491 mNewSubTodoAction->setEnabled( false );
1487 } 1492 }
1488} 1493}
1489 1494
1490void MainWindow::enableIncidenceActions( bool enabled ) 1495void MainWindow::enableIncidenceActions( bool enabled )
1491{ 1496{
1492 mShowAction->setEnabled( enabled ); 1497 mShowAction->setEnabled( enabled );
1493 mEditAction->setEnabled( enabled ); 1498 mEditAction->setEnabled( enabled );
1494 mDeleteAction->setEnabled( enabled ); 1499 mDeleteAction->setEnabled( enabled );
1495 1500
1496 mCloneAction->setEnabled( enabled ); 1501 mCloneAction->setEnabled( enabled );
1497 mMoveAction->setEnabled( enabled ); 1502 mMoveAction->setEnabled( enabled );
1498 mBeamAction->setEnabled( enabled ); 1503 mBeamAction->setEnabled( enabled );
1499 mCancelAction->setEnabled( enabled ); 1504 mCancelAction->setEnabled( enabled );
1500} 1505}
1501 1506
1502void MainWindow::importOL() 1507void MainWindow::importOL()
1503{ 1508{
1504#ifdef _OL_IMPORT_ 1509#ifdef _OL_IMPORT_
1505 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1510 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1506 id->exec(); 1511 id->exec();
1507 delete id; 1512 delete id;
1508 mView->updateView(); 1513 mView->updateView();
1509#endif 1514#endif
1510} 1515}
1511void MainWindow::importBday() 1516void MainWindow::importBday()
1512{ 1517{
1513 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1518 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1514 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1519 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1515 i18n("Import!"), i18n("Cancel"), 0, 1520 i18n("Import!"), i18n("Cancel"), 0,
1516 0, 1 ); 1521 0, 1 );
1517 if ( result == 0 ) { 1522 if ( result == 0 ) {
1518 mView->importBday(); 1523 mView->importBday();
1519 1524
1520 } 1525 }
1521 1526
1522 1527
1523} 1528}
1524void MainWindow::importQtopia() 1529void MainWindow::importQtopia()
1525{ 1530{
1526 //#ifndef DESKTOP_VERSION 1531 //#ifndef DESKTOP_VERSION
1527 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"); 1532 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");
1528#ifdef DESKTOP_VERSION 1533#ifdef DESKTOP_VERSION
1529 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"); 1534 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");
1530#endif 1535#endif
1531 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess, 1536 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mess,
1532 i18n("Import!"), i18n("Cancel"), 0, 1537 i18n("Import!"), i18n("Cancel"), 0,
1533 0, 1 ); 1538 0, 1 );
1534 if ( result == 0 ) { 1539 if ( result == 0 ) {
1535#ifndef DESKTOP_VERSION 1540#ifndef DESKTOP_VERSION
1536 QString datebook = Global::applicationFileName( "datebook", "datebook.xml"); 1541 QString datebook = Global::applicationFileName( "datebook", "datebook.xml");
1537 QString todolist = Global::applicationFileName( "todolist", "todolist.xml"); 1542 QString todolist = Global::applicationFileName( "todolist", "todolist.xml");
1538 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml"; 1543 QString categories = QString( getenv( "HOME" ) ) + "/Settings/Categories.xml";
1539#else 1544#else
1540 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml"; 1545 QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
1541 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml"; 1546 QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
1542 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml"; 1547 QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
1543#endif 1548#endif
1544 mView->importQtopia( categories, datebook, todolist ); 1549 mView->importQtopia( categories, datebook, todolist );
1545 } 1550 }
1546#if 0 1551#if 0
1547 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1552 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1548 i18n("Not supported \non desktop!\n"), 1553 i18n("Not supported \non desktop!\n"),
1549 i18n("Ok"), i18n("Cancel"), 0, 1554 i18n("Ok"), i18n("Cancel"), 0,
1550 0, 1 ); 1555 0, 1 );
1551 1556
1552#endif 1557#endif
1553} 1558}
1554 1559
1555void MainWindow::saveOnClose() 1560void MainWindow::saveOnClose()
1556{ 1561{
1557 KOPrefs *p = KOPrefs::instance(); 1562 KOPrefs *p = KOPrefs::instance();
1558 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1563 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1559 p->mToolBarUp = iconToolBar->x() > width()/2 || 1564 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1560 iconToolBar->y() > height()/2; 1565 iconToolBar->y() > height()/2;
1561 mView->writeSettings(); 1566 mView->writeSettings();
1562 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1567 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1563 save(); 1568 save();
1564} 1569}
1565void MainWindow::slotModifiedChanged( bool changed ) 1570void MainWindow::slotModifiedChanged( bool changed )
1566{ 1571{
1567 if ( mBlockAtStartup ) 1572 if ( mBlockAtStartup )
1568 return; 1573 return;
1569 1574
1570 int msec; 1575 int msec;
1571 // we store the changes after 1 minute, 1576 // we store the changes after 1 minute,
1572 // and for safety reasons after 10 minutes again 1577 // and for safety reasons after 10 minutes again
1573 if ( !mSyncManager->blockSave() ) 1578 if ( !mSyncManager->blockSave() )
1574 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1579 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1575 else 1580 else
1576 msec = 1000 * 600; 1581 msec = 1000 * 600;
1577 mSaveTimer.start( msec, true ); // 1 minute 1582 mSaveTimer.start( msec, true ); // 1 minute
1578 qDebug("KO: Saving File in %d secs!", msec/1000); 1583 qDebug("KO: Saving File in %d secs!", msec/1000);
1579 mCalendarModifiedFlag = true; 1584 mCalendarModifiedFlag = true;
1580} 1585}
1581void MainWindow::saveStopTimer() 1586void MainWindow::saveStopTimer()
1582{ 1587{
1583 mSaveTimer.stop(); 1588 mSaveTimer.stop();
1584 if (mSaveTimer.isActive() ) 1589 if (mSaveTimer.isActive() )
1585 qDebug("ti active "); 1590 qDebug("ti active ");
1586 else 1591 else
1587 qDebug("KO: Save timer stopped"); 1592 qDebug("KO: Save timer stopped");
1588} 1593}
1589void MainWindow::save() 1594void MainWindow::save()
1590{ 1595{
1591 if ( !mCalendarModifiedFlag ) { 1596 if ( !mCalendarModifiedFlag ) {
1592 qDebug("KO: Calendar not modified. Nothing saved."); 1597 qDebug("KO: Calendar not modified. Nothing saved.");
1593 return; 1598 return;
1594 } 1599 }
1595 if ( mSyncManager->blockSave() ) 1600 if ( mSyncManager->blockSave() )
1596 return; 1601 return;
1597 mSyncManager->setBlockSave(true); 1602 mSyncManager->setBlockSave(true);
1598 if ( mView->checkFileVersion( defaultFileName()) ) { 1603 if ( mView->checkFileVersion( defaultFileName()) ) {
1599 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1604 QTime neededSaveTime = QDateTime::currentDateTime().time();
1600 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1605 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1601 qDebug("KO: Start saving data to file!"); 1606 qDebug("KO: Start saving data to file!");
1602 mView->saveCalendar( defaultFileName() ); 1607 mView->saveCalendar( defaultFileName() );
1603 mCalendarModifiedFlag = false; 1608 mCalendarModifiedFlag = false;
1604 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1609 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1605 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1610 qDebug("KO: Needed %d ms for saving.",msNeeded );
1606 QString savemes; 1611 QString savemes;
1607 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1612 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1608 setCaption(savemes); 1613 setCaption(savemes);
1609 } else 1614 } else
1610 setCaption(i18n("Saving cancelled!")); 1615 setCaption(i18n("Saving cancelled!"));
1611 mSyncManager->setBlockSave( false ); 1616 mSyncManager->setBlockSave( false );
1612} 1617}
1613 1618
1614void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1619void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1615{ 1620{
1616 if ( !e->isAutoRepeat() ) { 1621 if ( !e->isAutoRepeat() ) {
1617 mFlagKeyPressed = false; 1622 mFlagKeyPressed = false;
1618 } 1623 }
1619} 1624}
1620void MainWindow::keyPressEvent ( QKeyEvent * e ) 1625void MainWindow::keyPressEvent ( QKeyEvent * e )
1621{ 1626{
1622 qApp->processEvents(); 1627 qApp->processEvents();
1623 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1628 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1624 e->ignore(); 1629 e->ignore();
1625 // qDebug(" ignore %d",e->isAutoRepeat() ); 1630 // qDebug(" ignore %d",e->isAutoRepeat() );
1626 return; 1631 return;
1627 } 1632 }
1628 if (! e->isAutoRepeat() ) 1633 if (! e->isAutoRepeat() )
1629 mFlagKeyPressed = true; 1634 mFlagKeyPressed = true;
1630 KOPrefs *p = KOPrefs::instance(); 1635 KOPrefs *p = KOPrefs::instance();
1631 bool showSelectedDates = false; 1636 bool showSelectedDates = false;
1632 int size; 1637 int size;
1633 int pro = 0; 1638 int pro = 0;
1634 //qDebug("MainWindow::keyPressEvent "); 1639 //qDebug("MainWindow::keyPressEvent ");
1635 switch ( e->key() ) { 1640 switch ( e->key() ) {
1636 case Qt::Key_Right: 1641 case Qt::Key_Right:
1637 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1642 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1638 mView->goNextMonth(); 1643 mView->goNextMonth();
1639 else 1644 else
1640 mView->goNext(); 1645 mView->goNext();
1641 showSelectedDates = true; 1646 showSelectedDates = true;
1642 break; 1647 break;
1643 case Qt::Key_Left: 1648 case Qt::Key_Left:
1644 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1649 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1645 mView->goPreviousMonth(); 1650 mView->goPreviousMonth();
1646 else 1651 else
1647 mView->goPrevious(); 1652 mView->goPrevious();
1648 showSelectedDates = true; 1653 showSelectedDates = true;
1649 break; 1654 break;
1650 case Qt::Key_Down: 1655 case Qt::Key_Down:
1651 mView->viewManager()->agendaView()->scrollOneHourDown(); 1656 mView->viewManager()->agendaView()->scrollOneHourDown();
1652 break; 1657 break;
1653 case Qt::Key_Up: 1658 case Qt::Key_Up:
1654 mView->viewManager()->agendaView()->scrollOneHourUp(); 1659 mView->viewManager()->agendaView()->scrollOneHourUp();
1655 break; 1660 break;
1656 case Qt::Key_K: 1661 case Qt::Key_K:
1657 mView->viewManager()->showMonthViewWeek(); 1662 mView->viewManager()->showMonthViewWeek();
1658 break; 1663 break;
1659 case Qt::Key_I: 1664 case Qt::Key_I:
1660 mView->showIncidence(); 1665 mView->showIncidence();
1661 break; 1666 break;
1662 case Qt::Key_Delete: 1667 case Qt::Key_Delete:
1663 case Qt::Key_Backspace: 1668 case Qt::Key_Backspace:
1664 mView->deleteIncidence(); 1669 mView->deleteIncidence();
1665 break; 1670 break;
1666 case Qt::Key_D: 1671 case Qt::Key_D:
1667 mView->viewManager()->showDayView(); 1672 mView->viewManager()->showDayView();
1668 showSelectedDates = true; 1673 showSelectedDates = true;
1669 break; 1674 break;
1670 case Qt::Key_O: 1675 case Qt::Key_O:
1671 mView->toggleFilerEnabled( ); 1676 mView->toggleFilerEnabled( );
1672 break; 1677 break;
1673 case Qt::Key_0: 1678 case Qt::Key_0:
1674 case Qt::Key_1: 1679 case Qt::Key_1:
1675 case Qt::Key_2: 1680 case Qt::Key_2:
1676 case Qt::Key_3: 1681 case Qt::Key_3:
1677 case Qt::Key_4: 1682 case Qt::Key_4:
1678 case Qt::Key_5: 1683 case Qt::Key_5:
1679 case Qt::Key_6: 1684 case Qt::Key_6:
1680 case Qt::Key_7: 1685 case Qt::Key_7:
1681 case Qt::Key_8: 1686 case Qt::Key_8:
1682 case Qt::Key_9: 1687 case Qt::Key_9:
1683 pro = e->key()-48; 1688 pro = e->key()-48;
1684 if ( pro == 0 ) 1689 if ( pro == 0 )
1685 pro = 10; 1690 pro = 10;
1686 if ( e->state() == Qt::ControlButton) 1691 if ( e->state() == Qt::ControlButton)
1687 pro += 10; 1692 pro += 10;
1688 break; 1693 break;
1689 case Qt::Key_M: 1694 case Qt::Key_M:
1690 mView->viewManager()->showMonthView(); 1695 mView->viewManager()->showMonthView();
1691 showSelectedDates = true; 1696 showSelectedDates = true;
1692 break; 1697 break;
1693 case Qt::Key_Insert: 1698 case Qt::Key_Insert:
1694 mView->newEvent(); 1699 mView->newEvent();
1695 break; 1700 break;
1696 case Qt::Key_S : 1701 case Qt::Key_S :
1697 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1702 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1698 mView->newSubTodo(); 1703 mView->newSubTodo();
1699 else 1704 else
1700 mView->dialogManager()->showSearchDialog(); 1705 mView->dialogManager()->showSearchDialog();
1701 break; 1706 break;
1702 case Qt::Key_Y : 1707 case Qt::Key_Y :
1703 case Qt::Key_Z : 1708 case Qt::Key_Z :
1704 mView->viewManager()->showWorkWeekView(); 1709 mView->viewManager()->showWorkWeekView();
1705 showSelectedDates = true; 1710 showSelectedDates = true;
1706 break; 1711 break;
1707 case Qt::Key_U : 1712 case Qt::Key_U :
1708 mView->viewManager()->showWeekView(); 1713 mView->viewManager()->showWeekView();
1709 showSelectedDates = true; 1714 showSelectedDates = true;
1710 break; 1715 break;
1711 case Qt::Key_H : 1716 case Qt::Key_H :
1712 keyBindings(); 1717 keyBindings();
1713 break; 1718 break;
1714 case Qt::Key_W: 1719 case Qt::Key_W:
1715 mView->viewManager()->showWhatsNextView(); 1720 mView->viewManager()->showWhatsNextView();
1716 break; 1721 break;
1717 case Qt::Key_L: 1722 case Qt::Key_L:
1718 mView->viewManager()->showListView(); 1723 mView->viewManager()->showListView();
1719 break; 1724 break;
1720 case Qt::Key_N: 1725 case Qt::Key_N:
1721 mView->viewManager()->showNextXView(); 1726 mView->viewManager()->showNextXView();
1722 showSelectedDates = true; 1727 showSelectedDates = true;
1723 break; 1728 break;
1724 case Qt::Key_V: 1729 case Qt::Key_V:
1725 mView->viewManager()->showTodoView(); 1730 mView->viewManager()->showTodoView();
1726 break; 1731 break;
1727 case Qt::Key_C: 1732 case Qt::Key_C:
1728 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() ); 1733 mView->viewManager()->agendaView()->setStartHour( QTime::currentTime ().hour() );
1729 break; 1734 break;
1730 case Qt::Key_P: 1735 case Qt::Key_P:
1731 mView->showDatePicker( ); 1736 mView->showDatePicker( );
1732 break; 1737 break;
1733 case Qt::Key_F: 1738 case Qt::Key_F:
1734 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1739 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1735 mView->editFilters(); 1740 mView->editFilters();
1736 else 1741 else
1737 mView->toggleFilter(); 1742 mView->toggleFilter();
1738 break; 1743 break;
1739 case Qt::Key_X: 1744 case Qt::Key_X:
1740 mView->toggleDateNavigatorWidget(); 1745 mView->toggleDateNavigatorWidget();
1741 break; 1746 break;
1742 case Qt::Key_Space: 1747 case Qt::Key_Space:
1743 mView->toggleExpand(); 1748 mView->toggleExpand();
1744 break; 1749 break;
1745 case Qt::Key_A: 1750 case Qt::Key_A:
1746 mView->toggleAllDaySize(); 1751 mView->toggleAllDaySize();
1747 break; 1752 break;
1748 case Qt::Key_T: 1753 case Qt::Key_T:
1749 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1754 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1750 mView->newTodo(); 1755 mView->newTodo();
1751 else { 1756 else {
1752 mView->goToday(); 1757 mView->goToday();
1753 showSelectedDates = true; 1758 showSelectedDates = true;
1754 } 1759 }
1755 break; 1760 break;
1756 case Qt::Key_J: 1761 case Qt::Key_J:
1757 mView->viewManager()->showJournalView(); 1762 mView->viewManager()->showJournalView();
1758 break; 1763 break;
1759 case Qt::Key_B: 1764 case Qt::Key_B:
1760 mView->editIncidenceDescription();; 1765 mView->editIncidenceDescription();;
1761 break; 1766 break;
1762 // case Qt::Key_Return: 1767 // case Qt::Key_Return:
1763 case Qt::Key_E: 1768 case Qt::Key_E:
1764 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1769 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1765 mView->newEvent(); 1770 mView->newEvent();
1766 else 1771 else
1767 mView->editIncidence(); 1772 mView->editIncidence();
1768 break; 1773 break;
1769 case Qt::Key_Plus: 1774 case Qt::Key_Plus:
1770 size = p->mHourSize +2; 1775 size = p->mHourSize +2;
1771 if ( size <= 22 ) 1776 if ( size <= 22 )
1772 configureAgenda( size ); 1777 configureAgenda( size );
1773 break; 1778 break;
1774 case Qt::Key_Minus: 1779 case Qt::Key_Minus:
1775 size = p->mHourSize - 2; 1780 size = p->mHourSize - 2;
1776 if ( size >= 4 ) 1781 if ( size >= 4 )
1777 configureAgenda( size ); 1782 configureAgenda( size );
1778 break; 1783 break;
1779 1784
1780 1785
1781 default: 1786 default:
1782 e->ignore(); 1787 e->ignore();
1783 } 1788 }
1784 if ( pro > 0 ) { 1789 if ( pro > 0 ) {
1785 mView->selectFilter( pro-1 ); 1790 mView->selectFilter( pro-1 );
1786 } 1791 }
1787 if ( showSelectedDates ) { 1792 if ( showSelectedDates ) {
1788 ;// setCaptionToDates(); 1793 ;// setCaptionToDates();
1789 } 1794 }
1790 1795
1791} 1796}
1792 1797
1793void MainWindow::fillFilterMenu() 1798void MainWindow::fillFilterMenu()
1794{ 1799{
1795 selectFilterMenu->clear(); 1800 selectFilterMenu->clear();
1796 bool disable = false; 1801 bool disable = false;
1797 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 ); 1802 selectFilterMenu->insertItem(i18n ( "Edit Filters" ), 0 );
1798 selectFilterMenu->insertSeparator(); 1803 selectFilterMenu->insertSeparator();
1799 if ( mView->filterView()->filtersEnabled() ) { 1804 if ( mView->filterView()->filtersEnabled() ) {
1800 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 ); 1805 selectFilterMenu->insertItem(i18n ( "Turn filter off" ), 1 );
1801 } 1806 }
1802 else { 1807 else {
1803 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 ); 1808 selectFilterMenu->insertItem(i18n ( "Turn filter on" ), 1 );
1804 disable = true; 1809 disable = true;
1805 } 1810 }
1806 selectFilterMenu->insertSeparator(); 1811 selectFilterMenu->insertSeparator();
1807 QPtrList<CalFilter> fili = mView->filters(); 1812 QPtrList<CalFilter> fili = mView->filters();
1808 CalFilter *curfilter = mView->filterView()->selectedFilter(); 1813 CalFilter *curfilter = mView->filterView()->selectedFilter();
1809 CalFilter *filter = fili.first(); 1814 CalFilter *filter = fili.first();
1810 int iii = 2; 1815 int iii = 2;
1811 while(filter) { 1816 while(filter) {
1812 selectFilterMenu->insertItem( filter->name(), iii ); 1817 selectFilterMenu->insertItem( filter->name(), iii );
1813 if ( filter == curfilter) 1818 if ( filter == curfilter)
1814 selectFilterMenu->setItemChecked( iii, true ); 1819 selectFilterMenu->setItemChecked( iii, true );
1815 if ( disable ) 1820 if ( disable )
1816 selectFilterMenu->setItemEnabled( iii, false ); 1821 selectFilterMenu->setItemEnabled( iii, false );
1817 filter = fili.next(); 1822 filter = fili.next();
1818 ++iii; 1823 ++iii;
1819 } 1824 }
1820} 1825}
1821void MainWindow::selectFilter( int fil ) 1826void MainWindow::selectFilter( int fil )
1822{ 1827{
1823 if ( fil == 0 ) { 1828 if ( fil == 0 ) {
1824 mView->editFilters( ); 1829 mView->editFilters( );
1825 } else if ( fil == 1 ){ 1830 } else if ( fil == 1 ){
1826 mView->toggleFilerEnabled( ); 1831 mView->toggleFilerEnabled( );
1827 } else { 1832 } else {
1828 mView->selectFilter( fil-2 ); 1833 mView->selectFilter( fil-2 );
1829 } 1834 }
1830} 1835}
1831void MainWindow::configureToolBar( int item ) 1836void MainWindow::configureToolBar( int item )
1832{ 1837{
1833 1838
1834 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) ); 1839 configureToolBarMenu->setItemChecked( item, !configureToolBarMenu-> isItemChecked ( item ) );
1835 KOPrefs *p = KOPrefs::instance(); 1840 KOPrefs *p = KOPrefs::instance();
1836 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 ); 1841 p-> mShowIconStretch= configureToolBarMenu->isItemChecked( 5 );
1837 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 ); 1842 p-> mShowIconNewEvent= configureToolBarMenu->isItemChecked( 10 );
1838 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 ); 1843 p->mShowIconNewTodo = configureToolBarMenu->isItemChecked( 20 );
1839 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 ); 1844 p-> mShowIconSearch= configureToolBarMenu->isItemChecked( 120 );
1840 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 ); 1845 p-> mShowIconList= configureToolBarMenu->isItemChecked( 30 );
1841 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 ); 1846 p-> mShowIconDay1= configureToolBarMenu->isItemChecked( 40 );
1842 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 ); 1847 p-> mShowIconDay5= configureToolBarMenu->isItemChecked( 50 );
1843 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 ); 1848 p-> mShowIconDay6= configureToolBarMenu->isItemChecked( 75 );
1844 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 ); 1849 p-> mShowIconDay7= configureToolBarMenu->isItemChecked( 60 );
1845 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 ); 1850 p-> mShowIconMonth= configureToolBarMenu->isItemChecked( 70 );
1846 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 ); 1851 p-> mShowIconTodoview= configureToolBarMenu->isItemChecked( 80 );
1847 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 ); 1852 p-> mShowIconBackFast= configureToolBarMenu->isItemChecked( 200 );
1848 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 ); 1853 p-> mShowIconBack = configureToolBarMenu->isItemChecked( 210 );
1849 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 ); 1854 p-> mShowIconToday= configureToolBarMenu->isItemChecked( 130 );
1850 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 ); 1855 p-> mShowIconForward= configureToolBarMenu->isItemChecked( 220 );
1851 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 ); 1856 p-> mShowIconForwardFast= configureToolBarMenu->isItemChecked( 230 );
1852 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 ); 1857 p-> mShowIconNextDays= configureToolBarMenu->isItemChecked( 100 );
1853 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 ); 1858 p-> mShowIconNext= configureToolBarMenu->isItemChecked( 110 );
1854 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 ); 1859 p-> mShowIconJournal= configureToolBarMenu->isItemChecked( 90 );
1855 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 ); 1860 p-> mShowIconWhatsThis= configureToolBarMenu->isItemChecked( 300 );
1856 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 ); 1861 p-> mShowIconWeekNum= configureToolBarMenu->isItemChecked( 400 );
1857 // initActions(); 1862 // initActions();
1858} 1863}
1859void MainWindow::setCaption ( const QString & c ) 1864void MainWindow::setCaption ( const QString & c )
1860{ 1865{
1861 QString cap = c; 1866 QString cap = c;
1862 cap.replace( QRegExp("\n"), " " ); 1867 cap.replace( QRegExp("\n"), " " );
1863 cap = cap.stripWhiteSpace(); 1868 cap = cap.stripWhiteSpace();
1864 if ( cap.isEmpty() ) 1869 if ( cap.isEmpty() )
1865 cap = "KO/Pi"; 1870 cap = "KO/Pi";
1866 QWidget::setCaption( cap ); 1871 QWidget::setCaption( cap );
1867} 1872}
1868void MainWindow::setCaptionToDates() 1873void MainWindow::setCaptionToDates()
1869{ 1874{
1870 QString selDates; 1875 QString selDates;
1871 QDate date = mView->startDate(); 1876 QDate date = mView->startDate();
1872 if ( ! date.isValid() ) { 1877 if ( ! date.isValid() ) {
1873 setCaption(""); 1878 setCaption("");
1874 return; 1879 return;
1875 } 1880 }
1876 selDates = KGlobal::locale()->formatDate( date, true); 1881 selDates = KGlobal::locale()->formatDate( date, true);
1877 if (mView->startDate() < mView->endDate() ) 1882 if (mView->startDate() < mView->endDate() )
1878 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true); 1883 selDates += " - " + KGlobal::locale()->formatDate(mView->endDate(), true);
1879 else { 1884 else {
1880 QString addString; 1885 QString addString;
1881 if ( date == QDateTime::currentDateTime().date() ) 1886 if ( date == QDateTime::currentDateTime().date() )
1882 addString = i18n("Today"); 1887 addString = i18n("Today");
1883 else if ( date == QDateTime::currentDateTime().date().addDays(1) ) 1888 else if ( date == QDateTime::currentDateTime().date().addDays(1) )
1884 addString = i18n("Tomorrow"); 1889 addString = i18n("Tomorrow");
1885 if ( !addString.isEmpty() ) 1890 if ( !addString.isEmpty() )
1886 selDates = addString+", "+selDates ; 1891 selDates = addString+", "+selDates ;
1887 } 1892 }
1888 setCaption( i18n("Dates: ") + selDates ); 1893 setCaption( i18n("Dates: ") + selDates );
1889 1894
1890} 1895}
1891void MainWindow::showConfigureAgenda( ) 1896void MainWindow::showConfigureAgenda( )
1892{ 1897{
1893 int iii; 1898 int iii;
1894 for ( iii = 1;iii<= 10 ;++iii ){ 1899 for ( iii = 1;iii<= 10 ;++iii ){
1895 configureAgendaMenu->setItemChecked( (iii+1)*2, false ); 1900 configureAgendaMenu->setItemChecked( (iii+1)*2, false );
1896 } 1901 }
1897 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true ); 1902 configureAgendaMenu->setItemChecked( (KOPrefs::instance()->mHourSize/2)*2, true );
1898} 1903}
1899void MainWindow::configureAgenda( int item ) 1904void MainWindow::configureAgenda( int item )
1900{ 1905{
1901 if ( KOPrefs::instance()->mHourSize == item ) 1906 if ( KOPrefs::instance()->mHourSize == item )
1902 return; 1907 return;
1903 KOPrefs::instance()->mHourSize=item; 1908 KOPrefs::instance()->mHourSize=item;
1904 mView->viewManager()->agendaView()->updateConfig(); 1909 mView->viewManager()->agendaView()->updateConfig();
1905} 1910}
1906 1911
1907void MainWindow::saveCalendar() 1912void MainWindow::saveCalendar()
1908{ 1913{
1909 QString fn = KOPrefs::instance()->mLastSaveFile; 1914 QString fn = KOPrefs::instance()->mLastSaveFile;
1910 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this ); 1915 fn = KFileDialog::getSaveFileName( fn, i18n("Save backup filename"), this );
1911 1916
1912 if ( fn == "" ) 1917 if ( fn == "" )
1913 return; 1918 return;
1914 QFileInfo info; 1919 QFileInfo info;
1915 info.setFile( fn ); 1920 info.setFile( fn );
1916 QString mes; 1921 QString mes;
1917 bool createbup = true; 1922 bool createbup = true;
1918 if ( info. exists() ) { 1923 if ( info. exists() ) {
1919 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ; 1924 mes = i18n("Backup file\nalready exists!\nOld backup file from:\n%1\nOverwrite?\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )) ;
1920 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 1925 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
1921 i18n("Overwrite!"), i18n("Cancel"), 0, 1926 i18n("Overwrite!"), i18n("Cancel"), 0,
1922 0, 1 ); 1927 0, 1 );
1923 if ( result != 0 ) { 1928 if ( result != 0 ) {
1924 createbup = false; 1929 createbup = false;
1925 } 1930 }
1926 } 1931 }
1927 if ( createbup ) { 1932 if ( createbup ) {
1928 mView->saveCalendar( fn ); 1933 mView->saveCalendar( fn );
1929 mes = i18n("KO/Pi:Saved %1").arg(fn); 1934 mes = i18n("KO/Pi:Saved %1").arg(fn);
1930 KOPrefs::instance()->mLastSaveFile = fn; 1935 KOPrefs::instance()->mLastSaveFile = fn;
1931 setCaption(mes); 1936 setCaption(mes);
1932 } 1937 }
1933} 1938}
1934void MainWindow::loadCalendar() 1939void MainWindow::loadCalendar()
1935{ 1940{
1936 1941
1937 QString fn = KOPrefs::instance()->mLastLoadFile; 1942 QString fn = KOPrefs::instance()->mLastLoadFile;
1938 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this ); 1943 fn = KFileDialog::getOpenFileName( fn, i18n("Load backup filename"), this );
1939 1944
1940 if ( fn == "" ) 1945 if ( fn == "" )
1941 return; 1946 return;
1942 QFileInfo info; 1947 QFileInfo info;
1943 info.setFile( fn ); 1948 info.setFile( fn );
1944 QString mess; 1949 QString mess;
1945 bool loadbup = true; 1950 bool loadbup = true;
1946 if ( info. exists() ) { 1951 if ( info. exists() ) {
1947 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 1952 mess = i18n("Backup file from:\n%1\nLoading backup\nfile will delete\nyour current Data!\n").arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
1948 int result = QMessageBox::warning( this, "KO/Pi: Warning!", 1953 int result = QMessageBox::warning( this, "KO/Pi: Warning!",
1949 mess, 1954 mess,
1950 i18n("Load!"), i18n("Cancel"), 0, 1955 i18n("Load!"), i18n("Cancel"), 0,
1951 0, 1 ); 1956 0, 1 );
1952 if ( result != 0 ) { 1957 if ( result != 0 ) {
1953 loadbup = false; 1958 loadbup = false;
1954 } 1959 }
1955 } else { 1960 } else {
1956 QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1961 QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1957 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0, 1962 i18n("Backup file\ndoes not exist!\nNothing loaded!"), 0, 0,
1958 0, 1 ); 1963 0, 1 );
1959 1964
1960 return; 1965 return;
1961 } 1966 }
1962 if ( loadbup ) { 1967 if ( loadbup ) {
1963 mView->openCalendar( fn ); 1968 mView->openCalendar( fn );
1964 KOPrefs::instance()->mLastLoadFile = fn; 1969 KOPrefs::instance()->mLastLoadFile = fn;
1965 mess = i18n("KO/Pi:Loaded %1").arg(fn) ; 1970 mess = i18n("KO/Pi:Loaded %1").arg(fn) ;
1966 setCaption(mess); 1971 setCaption(mess);
1967 } 1972 }
1968 1973
1969} 1974}
1970void MainWindow::quickImportIcal() 1975void MainWindow::quickImportIcal()
1971{ 1976{
1972 importFile( KOPrefs::instance()->mLastImportFile, false ); 1977 importFile( KOPrefs::instance()->mLastImportFile, false );
1973} 1978}
1974void MainWindow::importFile( QString fn, bool quick ) 1979void MainWindow::importFile( QString fn, bool quick )
1975{ 1980{
1976 QFileInfo info; 1981 QFileInfo info;
1977 info.setFile( fn ); 1982 info.setFile( fn );
1978 QString mess; 1983 QString mess;
1979 bool loadbup = true; 1984 bool loadbup = true;
1980 if ( !info. exists() ) { 1985 if ( !info. exists() ) {
1981 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30)); 1986 mess = i18n("Import file \n...%1\ndoes not exist!\nNothing imported!\n").arg(fn.right( 30));
1982 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1987 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1983 mess ); 1988 mess );
1984 return; 1989 return;
1985 } 1990 }
1986 int result = 0; 1991 int result = 0;
1987 if ( !quick ) { 1992 if ( !quick ) {
1988 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 )); 1993 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 ));
1989 result = QMessageBox::warning( this, "KO/Pi: Warning!", 1994 result = QMessageBox::warning( this, "KO/Pi: Warning!",
1990 mess, 1995 mess,
1991 "Import", "Cancel", 0, 1996 "Import", "Cancel", 0,
1992 0, 1 ); 1997 0, 1 );
1993 } 1998 }
1994 if ( result == 0 ) { 1999 if ( result == 0 ) {
1995 if ( mView->openCalendar( fn, true )) { 2000 if ( mView->openCalendar( fn, true )) {
1996 KOPrefs::instance()->mLastImportFile = fn; 2001 KOPrefs::instance()->mLastImportFile = fn;
1997 setCaption(i18n("Imported file successfully")); 2002 setCaption(i18n("Imported file successfully"));
1998 } else { 2003 } else {
1999 setCaption(i18n("Error importing file")); 2004 setCaption(i18n("Error importing file"));
2000 } 2005 }
2001 } 2006 }
2002} 2007}
2003 2008
2004void MainWindow::importIcal() 2009void MainWindow::importIcal()
2005{ 2010{
2006 2011
2007 QString fn =KOPrefs::instance()->mLastImportFile; 2012 QString fn =KOPrefs::instance()->mLastImportFile;
2008 2013
2009 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this ); 2014 fn =KFileDialog:: getOpenFileName( fn, i18n("Import filename(*.ics/*.vcs)"), this );
2010 if ( fn == "" ) 2015 if ( fn == "" )
2011 return; 2016 return;
2012 importFile( fn, true ); 2017 importFile( fn, true );
2013 2018
2014} 2019}
2015 2020
2016void MainWindow::exportVCalendar() 2021void MainWindow::exportVCalendar()
2017{ 2022{
2018 QString fn = KOPrefs::instance()->mLastVcalFile; 2023 QString fn = KOPrefs::instance()->mLastVcalFile;
2019 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this ); 2024 fn = KFileDialog::getSaveFileName( fn, i18n("Export vcal filename(*.vcs)"), this );
2020 if ( fn == "" ) 2025 if ( fn == "" )
2021 return; 2026 return;
2022 QFileInfo info; 2027 QFileInfo info;
2023 info.setFile( fn ); 2028 info.setFile( fn );
2024 QString mes; 2029 QString mes;
2025 bool createbup = true; 2030 bool createbup = true;
2026 if ( info. exists() ) { 2031 if ( info. exists() ) {
2027 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) ); 2032 mes = i18n("Save file\nalready exists!\nOld save file from:\n%1\nOverwrite?\n").arg (KGlobal::locale()->formatDateTime(info.lastModified (), true, false ) );
2028 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes, 2033 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),mes,
2029 i18n("Overwrite!"), i18n("Cancel"), 0, 2034 i18n("Overwrite!"), i18n("Cancel"), 0,
2030 0, 1 ); 2035 0, 1 );
2031 if ( result != 0 ) { 2036 if ( result != 0 ) {
2032 createbup = false; 2037 createbup = false;
2033 } 2038 }
2034 } 2039 }
2035 if ( createbup ) { 2040 if ( createbup ) {
2036 if ( mView->exportVCalendar( fn ) ) { 2041 if ( mView->exportVCalendar( fn ) ) {
2037 KOPrefs::instance()->mLastVcalFile = fn; 2042 KOPrefs::instance()->mLastVcalFile = fn;
2038 if ( fn.length() > 20 ) 2043 if ( fn.length() > 20 )
2039 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ; 2044 mes = i18n("KO/Pi:Exported to ...%1").arg(fn.right(20)) ;
2040 else 2045 else
2041 mes = i18n("KO/Pi:Exported to %1").arg(fn ); 2046 mes = i18n("KO/Pi:Exported to %1").arg(fn );
2042 setCaption(mes); 2047 setCaption(mes);
2043 } 2048 }
2044 } 2049 }
2045 2050
2046} 2051}
2047QString MainWindow::sentSyncFile() 2052QString MainWindow::sentSyncFile()
2048{ 2053{
2049#ifdef DESKTOP_VERSION 2054#ifdef DESKTOP_VERSION
2050 return locateLocal( "tmp", "copysynccal.ics" ); 2055 return locateLocal( "tmp", "copysynccal.ics" );
2051#else 2056#else
2052 return QString( "/tmp/copysynccal.ics" ); 2057 return QString( "/tmp/copysynccal.ics" );
2053#endif 2058#endif
2054} 2059}
2055 2060
2056void MainWindow::syncFileRequest() 2061void MainWindow::syncFileRequest()
2057{ 2062{
2058 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2063 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2059 mSyncManager->slotSyncMenu( 999 ); 2064 mSyncManager->slotSyncMenu( 999 );
2060 } 2065 }
2061 2066
2062 setCaption(i18n("Saving Data to temp file ..." )); 2067 setCaption(i18n("Saving Data to temp file ..." ));
2063 mView->saveCalendar( sentSyncFile() ); 2068 mView->saveCalendar( sentSyncFile() );
2064 setCaption(i18n("Data saved to temp file!" )); 2069 setCaption(i18n("Data saved to temp file!" ));
2065 2070
2066} 2071}
2067void MainWindow::getFile( bool success ) 2072void MainWindow::getFile( bool success )
2068{ 2073{
2069 if ( ! success ) { 2074 if ( ! success ) {
2070 setCaption( i18n("Error receiving file. Nothing changed!") ); 2075 setCaption( i18n("Error receiving file. Nothing changed!") );
2071 return; 2076 return;
2072 } 2077 }
2073 mView->openCalendar( sentSyncFile() ); 2078 mView->openCalendar( sentSyncFile() );
2074 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) { 2079 if ( KOPrefs::instance()->mPassiveSyncWithDesktop ) {
2075 mSyncManager->slotSyncMenu( 999 ); 2080 mSyncManager->slotSyncMenu( 999 );
2076 } 2081 }
2077 setCaption( i18n("Pi-Sync successful!") ); 2082 setCaption( i18n("Pi-Sync successful!") );
2078} 2083}
2079 2084
2080void MainWindow::printSel( ) 2085void MainWindow::printSel( )
2081{ 2086{
2082 mView->viewManager()->agendaView()->agenda()->printSelection(); 2087 mView->viewManager()->agendaView()->agenda()->printSelection();
2083} 2088}
2084 2089
2085void MainWindow::printCal() 2090void MainWindow::printCal()
2086{ 2091{
2087 mView->print();//mCp->showDialog(); 2092 mView->print();//mCp->showDialog();
2088} 2093}
2089 2094
2090 2095
2091#include "libkdepim/kdatepicker.h" 2096#include "libkdepim/kdatepicker.h"
2092#include <kdatetbl.h> 2097#include <kdatetbl.h>
2093void MainWindow::weekAction() 2098void MainWindow::weekAction()
2094{ 2099{
2095 int month; 2100 int month;
2096 KPopupFrame* popup = new KPopupFrame(this); 2101 KPopupFrame* popup = new KPopupFrame(this);
2097 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup); 2102 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(popup);
2098 // ----- 2103 // -----
2099 picker->resize(picker->sizeHint()); 2104 picker->resize(picker->sizeHint());
2100 popup->setMainWidget(picker); 2105 popup->setMainWidget(picker);
2101 picker->setFocus(); 2106 picker->setFocus();
2102 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); 2107 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2103 int x = 0; 2108 int x = 0;
2104 int y = iconToolBar->height(); 2109 int y = iconToolBar->height();
2105 int dX = 0; 2110 int dX = 0;
2106 int dY = 0; 2111 int dY = 0;
2107 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 2112 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
2108 if ( iconToolBar->y() > height()/2 ) { 2113 if ( iconToolBar->y() > height()/2 ) {
2109 dY = picker->sizeHint().height()+8; 2114 dY = picker->sizeHint().height()+8;
2110 y = 0; 2115 y = 0;
2111 } 2116 }
2112 } else { 2117 } else {
2113 if ( iconToolBar->x() > width()/2 ) { // right side 2118 if ( iconToolBar->x() > width()/2 ) { // right side
2114 x=0; 2119 x=0;
2115 dX= picker->sizeHint().width()+8; 2120 dX= picker->sizeHint().width()+8;
2116 y = 0; 2121 y = 0;
2117 } else { 2122 } else {
2118 x= iconToolBar->width(); 2123 x= iconToolBar->width();
2119 y = 0; 2124 y = 0;
2120 } 2125 }
2121 } 2126 }
2122 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() ); 2127 //qDebug("dax %d dy %d %d %d ", dX, dY, iconToolBar->x(), iconToolBar->y() );
2123 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY)))) 2128 if(popup->exec(iconToolBar->mapToGlobal(QPoint(x,y)-QPoint( dX,dY))))
2124 { 2129 {
2125 month = picker->getResult(); 2130 month = picker->getResult();
2126 emit selectWeek ( month ); 2131 emit selectWeek ( month );
2127 //qDebug("weekSelected %d ", month); 2132 //qDebug("weekSelected %d ", month);
2128 } 2133 }
2129 delete popup; 2134 delete popup;
2130} 2135}