summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp7
-rw-r--r--korganizer/mainwindow.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index aa30b52..3bc6081 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,341 +1,346 @@
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 <qmessagebox.h> 7#include <qmessagebox.h>
8#include <qlineedit.h> 8#include <qlineedit.h>
9#include <qfile.h> 9#include <qfile.h>
10#include <qdir.h> 10#include <qdir.h>
11#include <qapp.h> 11#include <qapp.h>
12#include <qfileinfo.h> 12#include <qfileinfo.h>
13#include <qlabel.h> 13#include <qlabel.h>
14#include <qmap.h> 14#include <qmap.h>
15#include <qwmatrix.h> 15#include <qwmatrix.h>
16#include <qtextbrowser.h> 16#include <qtextbrowser.h>
17#include <qtextstream.h> 17#include <qtextstream.h>
18#ifndef DESKTOP_VERSION 18#ifndef DESKTOP_VERSION
19#include <qpe/global.h> 19#include <qpe/global.h>
20#include <qpe/qpemenubar.h> 20#include <qpe/qpemenubar.h>
21#include <qpe/qpetoolbar.h> 21#include <qpe/qpetoolbar.h>
22#include <qpe/resource.h> 22#include <qpe/resource.h>
23#include <qpe/qpeapplication.h> 23#include <qpe/qpeapplication.h>
24#include <qtopia/alarmserver.h> 24#include <qtopia/alarmserver.h>
25#include <qtopia/qcopenvelope_qws.h> 25#include <qtopia/qcopenvelope_qws.h>
26#else 26#else
27#include <qmenubar.h> 27#include <qmenubar.h>
28#include <qtoolbar.h> 28#include <qtoolbar.h>
29#include <qapplication.h> 29#include <qapplication.h>
30//#include <resource.h> 30//#include <resource.h>
31 31
32#endif 32#endif
33#include <libkcal/calendarlocal.h> 33#include <libkcal/calendarlocal.h>
34#include <libkcal/todo.h> 34#include <libkcal/todo.h>
35#include <libkdepim/ksyncprofile.h> 35#include <libkdepim/ksyncprofile.h>
36#include <libkdepim/kincidenceformatter.h> 36#include <libkdepim/kincidenceformatter.h>
37 37
38#include "calendarview.h" 38#include "calendarview.h"
39#include "koviewmanager.h" 39#include "koviewmanager.h"
40#include "datenavigator.h" 40#include "datenavigator.h"
41#include "koagendaview.h" 41#include "koagendaview.h"
42#include "koagenda.h" 42#include "koagenda.h"
43#include "kodialogmanager.h" 43#include "kodialogmanager.h"
44#include "kdialogbase.h" 44#include "kdialogbase.h"
45#include "kapplication.h" 45#include "kapplication.h"
46#include "kofilterview.h" 46#include "kofilterview.h"
47#include "kstandarddirs.h" 47#include "kstandarddirs.h"
48#include "koprefs.h" 48#include "koprefs.h"
49#include "kfiledialog.h" 49#include "kfiledialog.h"
50#include "koglobals.h" 50#include "koglobals.h"
51#include "kglobal.h" 51#include "kglobal.h"
52#include "klocale.h" 52#include "klocale.h"
53#include "kconfig.h" 53#include "kconfig.h"
54#include "simplealarmclient.h" 54#include "simplealarmclient.h"
55#include "externalapphandler.h" 55#include "externalapphandler.h"
56 56
57using namespace KCal; 57using namespace KCal;
58#ifndef _WIN32_ 58#ifndef _WIN32_
59#include <unistd.h> 59#include <unistd.h>
60#else 60#else
61#include "koimportoldialog.h" 61#include "koimportoldialog.h"
62#endif 62#endif
63#include "mainwindow.h" 63#include "mainwindow.h"
64 64
65int globalFlagBlockStartup; 65int globalFlagBlockStartup;
66MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) : 66MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
67 QMainWindow( parent, name ) 67 QMainWindow( parent, name )
68{ 68{
69 69
70#ifdef DESKTOP_VERSION 70#ifdef DESKTOP_VERSION
71 setFont( QFont("Arial"), 14 ); 71 setFont( QFont("Arial"), 14 );
72#endif 72#endif
73 73
74 mClosed = false;
74 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 75 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
75 QString confFile = locateLocal("config","korganizerrc"); 76 QString confFile = locateLocal("config","korganizerrc");
76 QFileInfo finf ( confFile ); 77 QFileInfo finf ( confFile );
77 bool showWarning = !finf.exists(); 78 bool showWarning = !finf.exists();
78 setIcon(SmallIcon( "ko24" ) ); 79 setIcon(SmallIcon( "ko24" ) );
79 mBlockAtStartup = true; 80 mBlockAtStartup = true;
80 mFlagKeyPressed = false; 81 mFlagKeyPressed = false;
81 setCaption("KOrganizer/Pi"); 82 setCaption("KOrganizer/Pi");
82 KOPrefs *p = KOPrefs::instance(); 83 KOPrefs *p = KOPrefs::instance();
83 // if ( QApplication::desktop()->height() > 480 ) { 84 // if ( QApplication::desktop()->height() > 480 ) {
84// if ( p->mHourSize == 4 ) 85// if ( p->mHourSize == 4 )
85// p->mHourSize = 6; 86// p->mHourSize = 6;
86// } 87// }
87 if ( p->mHourSize > 18 ) 88 if ( p->mHourSize > 18 )
88 p->mHourSize = 18; 89 p->mHourSize = 18;
89 QMainWindow::ToolBarDock tbd; 90 QMainWindow::ToolBarDock tbd;
90 if ( p->mToolBarHor ) { 91 if ( p->mToolBarHor ) {
91 if ( p->mToolBarUp ) 92 if ( p->mToolBarUp )
92 tbd = Bottom; 93 tbd = Bottom;
93 else 94 else
94 tbd = Top; 95 tbd = Top;
95 } 96 }
96 else { 97 else {
97 if ( p->mToolBarUp ) 98 if ( p->mToolBarUp )
98 tbd = Right; 99 tbd = Right;
99 else 100 else
100 tbd = Left; 101 tbd = Left;
101 } 102 }
102 if ( KOPrefs::instance()->mUseAppColors ) 103 if ( KOPrefs::instance()->mUseAppColors )
103 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 104 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
104 globalFlagBlockStartup = 1; 105 globalFlagBlockStartup = 1;
105 iconToolBar = new QPEToolBar( this ); 106 iconToolBar = new QPEToolBar( this );
106 addToolBar (iconToolBar , tbd ); 107 addToolBar (iconToolBar , tbd );
107 mBlockSaveFlag = false; 108 mBlockSaveFlag = false;
108 mCalendarModifiedFlag = false; 109 mCalendarModifiedFlag = false;
109 110
110 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 111 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
111 splash->setAlignment ( AlignCenter ); 112 splash->setAlignment ( AlignCenter );
112 setCentralWidget( splash ); 113 setCentralWidget( splash );
113#ifndef DESKTOP_VERSION 114#ifndef DESKTOP_VERSION
114 showMaximized(); 115 showMaximized();
115#endif 116#endif
116 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 117 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
117 setDefaultPreferences(); 118 setDefaultPreferences();
118 mCalendar = new CalendarLocal(); 119 mCalendar = new CalendarLocal();
119 mView = new CalendarView( mCalendar, this,"mCalendar " ); 120 mView = new CalendarView( mCalendar, this,"mCalendar " );
120 mView->hide(); 121 mView->hide();
121 //mView->resize(splash->size() ); 122 //mView->resize(splash->size() );
122 initActions(); 123 initActions();
123#ifndef DESKTOP_VERSION 124#ifndef DESKTOP_VERSION
124 iconToolBar->show(); 125 iconToolBar->show();
125 qApp->processEvents(); 126 qApp->processEvents();
126#endif 127#endif
127 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 128 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
128 int vh = height() ; 129 int vh = height() ;
129 int vw = width(); 130 int vw = width();
130 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 131 //qDebug("Toolbar hei %d ",iconToolBar->height() );
131 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 132 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
132 vh -= iconToolBar->height(); 133 vh -= iconToolBar->height();
133 } else { 134 } else {
134 vw -= iconToolBar->height(); 135 vw -= iconToolBar->height();
135 } 136 }
136 //mView->setMaximumSize( splash->size() ); 137 //mView->setMaximumSize( splash->size() );
137 //mView->resize( splash->size() ); 138 //mView->resize( splash->size() );
138 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 139 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
139 mView->readSettings(); 140 mView->readSettings();
140 bool oldOpened = false; 141 bool oldOpened = false;
141 bool newFile = false; 142 bool newFile = false;
142 if( !QFile::exists( defaultFileName() ) ) { 143 if( !QFile::exists( defaultFileName() ) ) {
143 QFileInfo finfo ( defaultFileName() ); 144 QFileInfo finfo ( defaultFileName() );
144 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 145 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
145 qDebug("oldfile %s ", oldFile.latin1()); 146 qDebug("oldfile %s ", oldFile.latin1());
146 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"; 147 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";
147 finfo.setFile( oldFile ); 148 finfo.setFile( oldFile );
148 if (finfo.exists() ) { 149 if (finfo.exists() ) {
149 KMessageBox::information( this, message); 150 KMessageBox::information( this, message);
150 mView->openCalendar( oldFile ); 151 mView->openCalendar( oldFile );
151 qApp->processEvents(); 152 qApp->processEvents();
152 } else { 153 } else {
153 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 154 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
154 finfo.setFile( oldFile ); 155 finfo.setFile( oldFile );
155 if (finfo.exists() ) { 156 if (finfo.exists() ) {
156 KMessageBox::information( this, message); 157 KMessageBox::information( this, message);
157 mView->openCalendar( oldFile ); 158 mView->openCalendar( oldFile );
158 qApp->processEvents(); 159 qApp->processEvents();
159 } 160 }
160 } 161 }
161 mView->saveCalendar( defaultFileName() ); 162 mView->saveCalendar( defaultFileName() );
162 newFile = true; 163 newFile = true;
163 } 164 }
164 165
165 QTime neededSaveTime = QDateTime::currentDateTime().time(); 166 QTime neededSaveTime = QDateTime::currentDateTime().time();
166 if ( ! oldOpened ) 167 if ( ! oldOpened )
167 mView->openCalendar( defaultFileName() ); 168 mView->openCalendar( defaultFileName() );
168 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 169 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
169 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 170 qDebug("KO: Calendar loading time: %d ms",msNeeded );
170 171
171 if ( KOPrefs::instance()->mLanguageChanged ) { 172 if ( KOPrefs::instance()->mLanguageChanged ) {
172 KOPrefs::instance()->setCategoryDefaults(); 173 KOPrefs::instance()->setCategoryDefaults();
173 int count = mView->addCategories(); 174 int count = mView->addCategories();
174 KOPrefs::instance()->mLanguageChanged = false; 175 KOPrefs::instance()->mLanguageChanged = false;
175 } 176 }
176 processIncidenceSelection( 0 ); 177 processIncidenceSelection( 0 );
177 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 178 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
178 SLOT( processIncidenceSelection( Incidence * ) ) ); 179 SLOT( processIncidenceSelection( Incidence * ) ) );
179 connect( mView, SIGNAL( modifiedChanged( bool ) ), 180 connect( mView, SIGNAL( modifiedChanged( bool ) ),
180 SLOT( slotModifiedChanged( bool ) ) ); 181 SLOT( slotModifiedChanged( bool ) ) );
181 182
182 183
183 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 184 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
184 mView->setModified( false ); 185 mView->setModified( false );
185 mBlockAtStartup = false; 186 mBlockAtStartup = false;
186 mView->setModified( false ); 187 mView->setModified( false );
187 setCentralWidget( mView ); 188 setCentralWidget( mView );
188 globalFlagBlockStartup = 0; 189 globalFlagBlockStartup = 0;
189 mView->show(); 190 mView->show();
190 delete splash; 191 delete splash;
191 if ( newFile ) 192 if ( newFile )
192 mView->updateConfig(); 193 mView->updateConfig();
193 // qApp->processEvents(); 194 // qApp->processEvents();
194 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 195 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
195 fillSyncMenu(); 196 fillSyncMenu();
196 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 197 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
197 if ( showWarning ) { 198 if ( showWarning ) {
198 KMessageBox::information( this, 199 KMessageBox::information( this,
199 "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"); 200 "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");
200 qApp->processEvents(); 201 qApp->processEvents();
201 mView->dialogManager()->showSyncOptions(); 202 mView->dialogManager()->showSyncOptions();
202 } 203 }
203 204
204 //US listen for result adressed from Ka/Pi 205 //US listen for result adressed from Ka/Pi
205#ifndef DESKTOP_VERSION 206#ifndef DESKTOP_VERSION
206 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 207 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
207#endif 208#endif
208} 209}
209MainWindow::~MainWindow() 210MainWindow::~MainWindow()
210{ 211{
211 //qDebug("MainWindow::~MainWindow() "); 212 //qDebug("MainWindow::~MainWindow() ");
212 //save toolbar location 213 //save toolbar location
213 214
214 delete mCalendar; 215 delete mCalendar;
215 delete KOPrefs::instance(); 216 delete KOPrefs::instance();
216 delete KIncidenceFormatter::instance(); 217 delete KIncidenceFormatter::instance();
217 218
218 219
219} 220}
220void MainWindow::showMaximized () 221void MainWindow::showMaximized ()
221{ 222{
222#ifndef DESKTOP_VERSION 223#ifndef DESKTOP_VERSION
223 if ( ! globalFlagBlockStartup ) 224 if ( ! globalFlagBlockStartup )
224 mView->goToday(); 225 if ( mClosed )
226 mView->goToday();
225#endif 227#endif
226 QWidget::showMaximized () ; 228 QWidget::showMaximized () ;
229 mClosed = false;
227} 230}
228void MainWindow::closeEvent( QCloseEvent* ce ) 231void MainWindow::closeEvent( QCloseEvent* ce )
229{ 232{
230 233
231 234
232 235
233 if ( ! KOPrefs::instance()->mAskForQuit ) { 236 if ( ! KOPrefs::instance()->mAskForQuit ) {
234 saveOnClose(); 237 saveOnClose();
238 mClosed = true;
235 ce->accept(); 239 ce->accept();
236 return; 240 return;
237 241
238 } 242 }
239 243
240 switch( QMessageBox::information( this, "KO/Pi", 244 switch( QMessageBox::information( this, "KO/Pi",
241 i18n("Do you really want\nto close KO/Pi?"), 245 i18n("Do you really want\nto close KO/Pi?"),
242 i18n("Close"), i18n("No"), 246 i18n("Close"), i18n("No"),
243 0, 0 ) ) { 247 0, 0 ) ) {
244 case 0: 248 case 0:
245 saveOnClose(); 249 saveOnClose();
250 mClosed = true;
246 ce->accept(); 251 ce->accept();
247 break; 252 break;
248 case 1: 253 case 1:
249 ce->ignore(); 254 ce->ignore();
250 break; 255 break;
251 case 2: 256 case 2:
252 257
253 default: 258 default:
254 break; 259 break;
255 } 260 }
256 261
257 262
258} 263}
259 264
260void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 265void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
261{ 266{
262 QDataStream stream( data, IO_ReadOnly ); 267 QDataStream stream( data, IO_ReadOnly );
263 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 268 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
264 //QString datamess; 269 //QString datamess;
265 //qDebug("message "); 270 //qDebug("message ");
266 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 271 qDebug("KO: QCOP message received: %s ", cmsg.data() );
267 272
268 if ( cmsg == "-writeFile" ) { 273 if ( cmsg == "-writeFile" ) {
269 // I made from the "-writeFile" an "-writeAlarm" 274 // I made from the "-writeFile" an "-writeAlarm"
270 mView->viewManager()->showWhatsNextView(); 275 mView->viewManager()->showWhatsNextView();
271 mCalendar->checkAlarmForIncidence( 0, true); 276 mCalendar->checkAlarmForIncidence( 0, true);
272 showMaximized(); 277 showMaximized();
273 raise(); 278 raise();
274 return; 279 return;
275 } 280 }
276 281
277 if ( cmsg == "-writeFile" ) { 282 if ( cmsg == "-writeFile" ) {
278 // I made from the "-writeFile" an "-writeAlarm" 283 // I made from the "-writeFile" an "-writeAlarm"
279 mView->viewManager()->showWhatsNextView(); 284 mView->viewManager()->showWhatsNextView();
280 mCalendar->checkAlarmForIncidence( 0, true); 285 mCalendar->checkAlarmForIncidence( 0, true);
281 showMaximized(); 286 showMaximized();
282 raise(); 287 raise();
283 return; 288 return;
284 289
285 } 290 }
286 if ( cmsg == "-writeFileSilent" ) { 291 if ( cmsg == "-writeFileSilent" ) {
287 // I made from the "-writeFile" an "-writeAlarm" 292 // I made from the "-writeFile" an "-writeAlarm"
288 // mView->viewManager()->showWhatsNextView(); 293 // mView->viewManager()->showWhatsNextView();
289 mCalendar->checkAlarmForIncidence( 0, true); 294 mCalendar->checkAlarmForIncidence( 0, true);
290 //showMaximized(); 295 //showMaximized();
291 //raise(); 296 //raise();
292 hide(); 297 hide();
293 return; 298 return;
294 } 299 }
295 if ( cmsg == "-newCountdown" ) { 300 if ( cmsg == "-newCountdown" ) {
296 qDebug("newCountdown "); 301 qDebug("newCountdown ");
297 302
298 } 303 }
299 QString msg ; 304 QString msg ;
300 QString allmsg = cmsg; 305 QString allmsg = cmsg;
301 while ( allmsg.length() > 0 ) { 306 while ( allmsg.length() > 0 ) {
302 int nextC = allmsg.find( "-", 1 ); 307 int nextC = allmsg.find( "-", 1 );
303 if ( nextC == -1 ) { 308 if ( nextC == -1 ) {
304 msg = allmsg; 309 msg = allmsg;
305 allmsg = ""; 310 allmsg = "";
306 } else{ 311 } else{
307 msg = allmsg.left( nextC ); 312 msg = allmsg.left( nextC );
308 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 313 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
309 } 314 }
310 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 315 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
311 if ( msg == "-newEvent" ) { 316 if ( msg == "-newEvent" ) {
312 mView->newEvent(); 317 mView->newEvent();
313 } 318 }
314 if ( msg == "-newTodo" ) { 319 if ( msg == "-newTodo" ) {
315 mView->newTodo(); 320 mView->newTodo();
316 321
317 } 322 }
318 if ( msg == "-showWN" ) { 323 if ( msg == "-showWN" ) {
319 mView->viewManager()->showWhatsNextView(); 324 mView->viewManager()->showWhatsNextView();
320 } 325 }
321 if ( msg == "-showTodo" ) { 326 if ( msg == "-showTodo" ) {
322 mView->viewManager()->showTodoView(); 327 mView->viewManager()->showTodoView();
323 } 328 }
324 if ( msg == "-showList" ) { 329 if ( msg == "-showList" ) {
325 mView->viewManager()->showListView(); 330 mView->viewManager()->showListView();
326 } 331 }
327 else if ( msg == "-showDay" ) { 332 else if ( msg == "-showDay" ) {
328 mView->viewManager()->showDayView(); 333 mView->viewManager()->showDayView();
329 } 334 }
330 else if ( msg == "-showWWeek" ) { 335 else if ( msg == "-showWWeek" ) {
331 mView->viewManager()->showWorkWeekView(); 336 mView->viewManager()->showWorkWeekView();
332 } 337 }
333 else if ( msg == "-ringSync" ) { 338 else if ( msg == "-ringSync" ) {
334 multiSync( false ); 339 multiSync( false );
335 } 340 }
336 else if ( msg == "-showWeek" ) { 341 else if ( msg == "-showWeek" ) {
337 mView->viewManager()->showWeekView(); 342 mView->viewManager()->showWeekView();
338 } 343 }
339 else if ( msg == "-showTodo" ) { 344 else if ( msg == "-showTodo" ) {
340 mView->viewManager()->showTodoView(); 345 mView->viewManager()->showTodoView();
341 } 346 }
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 3e854cb..47a7a90 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,122 +1,123 @@
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 7
8#include <libkcal/incidence.h> 8#include <libkcal/incidence.h>
9#include "simplealarmclient.h" 9#include "simplealarmclient.h"
10 10
11class QAction; 11class QAction;
12class CalendarView; 12class CalendarView;
13class KSyncProfile; 13class KSyncProfile;
14#ifdef DESKTOP_VERSION 14#ifdef DESKTOP_VERSION
15 15
16#define QPEToolBar QToolBar 16#define QPEToolBar QToolBar
17#define QPEMenuBar QMenuBar 17#define QPEMenuBar QMenuBar
18#endif 18#endif
19class QPEToolBar; 19class QPEToolBar;
20 20
21namespace KCal { 21namespace KCal {
22class CalendarLocal; 22class CalendarLocal;
23} 23}
24 24
25using namespace KCal; 25using namespace KCal;
26 26
27class MainWindow : public QMainWindow 27class MainWindow : public QMainWindow
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30 public: 30 public:
31 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = ""); 31 MainWindow( QWidget *parent = 0, const char *name = 0, QString command = "");
32 ~MainWindow(); 32 ~MainWindow();
33 public slots: 33 public slots:
34 virtual void showMaximized (); 34 virtual void showMaximized ();
35 void configureAgenda( int ); 35 void configureAgenda( int );
36 void recieve( const QCString& msg, const QByteArray& data ); 36 void recieve( const QCString& msg, const QByteArray& data );
37 static QString defaultFileName(); 37 static QString defaultFileName();
38 static QString resourcePath(); 38 static QString resourcePath();
39 protected slots: 39 protected slots:
40 void setCaptionToDates(); 40 void setCaptionToDates();
41 int ringSync(); 41 int ringSync();
42 void multiSync( bool askforPrefs = false ); 42 void multiSync( bool askforPrefs = false );
43 void about(); 43 void about();
44 void licence(); 44 void licence();
45 void faq(); 45 void faq();
46 void usertrans(); 46 void usertrans();
47 void features(); 47 void features();
48 void synchowto(); 48 void synchowto();
49 void whatsNew(); 49 void whatsNew();
50 void keyBindings(); 50 void keyBindings();
51 void aboutAutoSaving();; 51 void aboutAutoSaving();;
52 void aboutKnownBugs(); 52 void aboutKnownBugs();
53 53
54 void processIncidenceSelection( Incidence * ); 54 void processIncidenceSelection( Incidence * );
55 55
56 void importQtopia(); 56 void importQtopia();
57 void importBday(); 57 void importBday();
58 void importOL(); 58 void importOL();
59 void importIcal(); 59 void importIcal();
60 void importFile( QString, bool ); 60 void importFile( QString, bool );
61 void quickImportIcal(); 61 void quickImportIcal();
62 62
63 void slotModifiedChanged( bool ); 63 void slotModifiedChanged( bool );
64 64
65 void save(); 65 void save();
66 void configureToolBar( int ); 66 void configureToolBar( int );
67 void printSel(); 67 void printSel();
68 void printCal(); 68 void printCal();
69 void saveCalendar(); 69 void saveCalendar();
70 void loadCalendar(); 70 void loadCalendar();
71 void exportVCalendar(); 71 void exportVCalendar();
72 void fillFilterMenu(); 72 void fillFilterMenu();
73 void selectFilter( int ); 73 void selectFilter( int );
74 74
75 void slotSyncMenu( int ); 75 void slotSyncMenu( int );
76 void syncSSH(); 76 void syncSSH();
77 void confSync(); 77 void confSync();
78 void syncSharp(); 78 void syncSharp();
79 void syncPhone(); 79 void syncPhone();
80 void syncLocalFile(); 80 void syncLocalFile();
81 bool syncWithFile( QString, bool ); 81 bool syncWithFile( QString, bool );
82 void quickSyncLocalFile(); 82 void quickSyncLocalFile();
83 83
84 84
85 protected: 85 protected:
86 void displayText( QString, QString); 86 void displayText( QString, QString);
87 void displayFile( QString, QString); 87 void displayFile( QString, QString);
88 88
89 void enableIncidenceActions( bool ); 89 void enableIncidenceActions( bool );
90 90
91 private: 91 private:
92 bool mClosed;
92 void saveOnClose(); 93 void saveOnClose();
93 int mCurrentSyncProfile; 94 int mCurrentSyncProfile;
94 void syncRemote( KSyncProfile* , bool ask = true); 95 void syncRemote( KSyncProfile* , bool ask = true);
95 void fillSyncMenu(); 96 void fillSyncMenu();
96 bool mFlagKeyPressed; 97 bool mFlagKeyPressed;
97 bool mBlockAtStartup; 98 bool mBlockAtStartup;
98 QPEToolBar *iconToolBar; 99 QPEToolBar *iconToolBar;
99 void initActions(); 100 void initActions();
100 void setDefaultPreferences(); 101 void setDefaultPreferences();
101 void keyPressEvent ( QKeyEvent * ) ; 102 void keyPressEvent ( QKeyEvent * ) ;
102 void keyReleaseEvent ( QKeyEvent * ) ; 103 void keyReleaseEvent ( QKeyEvent * ) ;
103 QPopupMenu *configureToolBarMenu; 104 QPopupMenu *configureToolBarMenu;
104 QPopupMenu *selectFilterMenu; 105 QPopupMenu *selectFilterMenu;
105 QPopupMenu *configureAgendaMenu, *syncMenu; 106 QPopupMenu *configureAgendaMenu, *syncMenu;
106 CalendarLocal *mCalendar; 107 CalendarLocal *mCalendar;
107 CalendarView *mView; 108 CalendarView *mView;
108 QString getPassword(); 109 QString getPassword();
109 QAction *mNewSubTodoAction; 110 QAction *mNewSubTodoAction;
110 111
111 QAction *mShowAction; 112 QAction *mShowAction;
112 QAction *mEditAction; 113 QAction *mEditAction;
113 QAction *mDeleteAction; 114 QAction *mDeleteAction;
114 void closeEvent( QCloseEvent* ce ); 115 void closeEvent( QCloseEvent* ce );
115 SimpleAlarmClient mAlarmClient; 116 SimpleAlarmClient mAlarmClient;
116 QTimer mSaveTimer; 117 QTimer mSaveTimer;
117 bool mBlockSaveFlag; 118 bool mBlockSaveFlag;
118 bool mCalendarModifiedFlag; 119 bool mCalendarModifiedFlag;
119 QPixmap loadPixmap( QString ); 120 QPixmap loadPixmap( QString );
120}; 121};
121 122
122#endif 123#endif