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