summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp8
-rw-r--r--korganizer/mainwindow.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 4b00062..d4fadcb 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1,601 +1,609 @@
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 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc"; 74 //QString confFile = KStandardDirs::appDir() + "config/korganizerrc";
75 QString confFile = locateLocal("config","korganizerrc"); 75 QString confFile = locateLocal("config","korganizerrc");
76 QFileInfo finf ( confFile ); 76 QFileInfo finf ( confFile );
77 bool showWarning = !finf.exists(); 77 bool showWarning = !finf.exists();
78 setIcon(SmallIcon( "ko24" ) ); 78 setIcon(SmallIcon( "ko24" ) );
79 mBlockAtStartup = true; 79 mBlockAtStartup = true;
80 mFlagKeyPressed = false; 80 mFlagKeyPressed = false;
81 setCaption("KOrganizer/Pi"); 81 setCaption("KOrganizer/Pi");
82 KOPrefs *p = KOPrefs::instance(); 82 KOPrefs *p = KOPrefs::instance();
83 // if ( QApplication::desktop()->height() > 480 ) { 83 // if ( QApplication::desktop()->height() > 480 ) {
84// if ( p->mHourSize == 4 ) 84// if ( p->mHourSize == 4 )
85// p->mHourSize = 6; 85// p->mHourSize = 6;
86// } 86// }
87 if ( p->mHourSize > 18 ) 87 if ( p->mHourSize > 18 )
88 p->mHourSize = 18; 88 p->mHourSize = 18;
89 QMainWindow::ToolBarDock tbd; 89 QMainWindow::ToolBarDock tbd;
90 if ( p->mToolBarHor ) { 90 if ( p->mToolBarHor ) {
91 if ( p->mToolBarUp ) 91 if ( p->mToolBarUp )
92 tbd = Bottom; 92 tbd = Bottom;
93 else 93 else
94 tbd = Top; 94 tbd = Top;
95 } 95 }
96 else { 96 else {
97 if ( p->mToolBarUp ) 97 if ( p->mToolBarUp )
98 tbd = Right; 98 tbd = Right;
99 else 99 else
100 tbd = Left; 100 tbd = Left;
101 } 101 }
102 if ( KOPrefs::instance()->mUseAppColors ) 102 if ( KOPrefs::instance()->mUseAppColors )
103 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true ); 103 QApplication::setPalette( QPalette (KOPrefs::instance()->mAppColor1, KOPrefs::instance()->mAppColor2), true );
104 globalFlagBlockStartup = 1; 104 globalFlagBlockStartup = 1;
105 iconToolBar = new QPEToolBar( this ); 105 iconToolBar = new QPEToolBar( this );
106 addToolBar (iconToolBar , tbd ); 106 addToolBar (iconToolBar , tbd );
107 mBlockSaveFlag = false; 107 mBlockSaveFlag = false;
108 mCalendarModifiedFlag = false; 108 mCalendarModifiedFlag = false;
109 109
110 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 110 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
111 splash->setAlignment ( AlignCenter ); 111 splash->setAlignment ( AlignCenter );
112 setCentralWidget( splash ); 112 setCentralWidget( splash );
113#ifndef DESKTOP_VERSION 113#ifndef DESKTOP_VERSION
114 showMaximized(); 114 showMaximized();
115#endif 115#endif
116 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ()); 116 //qDebug("Mainwidget x %d y %d w %d h %d", x(), y(), width(), height ());
117 setDefaultPreferences(); 117 setDefaultPreferences();
118 mCalendar = new CalendarLocal(); 118 mCalendar = new CalendarLocal();
119 mView = new CalendarView( mCalendar, this,"mCalendar " ); 119 mView = new CalendarView( mCalendar, this,"mCalendar " );
120 mView->hide(); 120 mView->hide();
121 //mView->resize(splash->size() ); 121 //mView->resize(splash->size() );
122 initActions(); 122 initActions();
123#ifndef DESKTOP_VERSION 123#ifndef DESKTOP_VERSION
124 iconToolBar->show(); 124 iconToolBar->show();
125 qApp->processEvents(); 125 qApp->processEvents();
126#endif 126#endif
127 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ()); 127 //qDebug("Splashwidget x %d y %d w %d h %d", splash-> x(), splash->y(), splash->width(),splash-> height ());
128 int vh = height() ; 128 int vh = height() ;
129 int vw = width(); 129 int vw = width();
130 //qDebug("Toolbar hei %d ",iconToolBar->height() ); 130 //qDebug("Toolbar hei %d ",iconToolBar->height() );
131 if ( iconToolBar->orientation () == Qt:: Horizontal ) { 131 if ( iconToolBar->orientation () == Qt:: Horizontal ) {
132 vh -= iconToolBar->height(); 132 vh -= iconToolBar->height();
133 } else { 133 } else {
134 vw -= iconToolBar->height(); 134 vw -= iconToolBar->height();
135 } 135 }
136 //mView->setMaximumSize( splash->size() ); 136 //mView->setMaximumSize( splash->size() );
137 //mView->resize( splash->size() ); 137 //mView->resize( splash->size() );
138 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 138 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
139 mView->readSettings(); 139 mView->readSettings();
140 bool oldOpened = false; 140 bool oldOpened = false;
141 bool newFile = false; 141 bool newFile = false;
142 if( !QFile::exists( defaultFileName() ) ) { 142 if( !QFile::exists( defaultFileName() ) ) {
143 QFileInfo finfo ( defaultFileName() ); 143 QFileInfo finfo ( defaultFileName() );
144 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics"); 144 QString oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/Applications/korganizer/mycalendar.ics");
145 qDebug("oldfile %s ", oldFile.latin1()); 145 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"; 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 finfo.setFile( oldFile ); 147 finfo.setFile( oldFile );
148 if (finfo.exists() ) { 148 if (finfo.exists() ) {
149 KMessageBox::information( this, message); 149 KMessageBox::information( this, message);
150 mView->openCalendar( oldFile ); 150 mView->openCalendar( oldFile );
151 qApp->processEvents(); 151 qApp->processEvents();
152 } else { 152 } else {
153 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics"); 153 oldFile = QDir::convertSeparators( QDir::homeDirPath()+"/korganizer/mycalendar.ics");
154 finfo.setFile( oldFile ); 154 finfo.setFile( oldFile );
155 if (finfo.exists() ) { 155 if (finfo.exists() ) {
156 KMessageBox::information( this, message); 156 KMessageBox::information( this, message);
157 mView->openCalendar( oldFile ); 157 mView->openCalendar( oldFile );
158 qApp->processEvents(); 158 qApp->processEvents();
159 } 159 }
160 } 160 }
161 mView->saveCalendar( defaultFileName() ); 161 mView->saveCalendar( defaultFileName() );
162 newFile = true; 162 newFile = true;
163 } 163 }
164 164
165 QTime neededSaveTime = QDateTime::currentDateTime().time(); 165 QTime neededSaveTime = QDateTime::currentDateTime().time();
166 if ( ! oldOpened ) 166 if ( ! oldOpened )
167 mView->openCalendar( defaultFileName() ); 167 mView->openCalendar( defaultFileName() );
168 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 168 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
169 qDebug("KO: Calendar loading time: %d ms",msNeeded ); 169 qDebug("KO: Calendar loading time: %d ms",msNeeded );
170 170
171 if ( KOPrefs::instance()->mLanguageChanged ) { 171 if ( KOPrefs::instance()->mLanguageChanged ) {
172 KOPrefs::instance()->setCategoryDefaults(); 172 KOPrefs::instance()->setCategoryDefaults();
173 int count = mView->addCategories(); 173 int count = mView->addCategories();
174 KOPrefs::instance()->mLanguageChanged = false; 174 KOPrefs::instance()->mLanguageChanged = false;
175 } 175 }
176 processIncidenceSelection( 0 ); 176 processIncidenceSelection( 0 );
177 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ), 177 connect( mView, SIGNAL( incidenceSelected( Incidence * ) ),
178 SLOT( processIncidenceSelection( Incidence * ) ) ); 178 SLOT( processIncidenceSelection( Incidence * ) ) );
179 connect( mView, SIGNAL( modifiedChanged( bool ) ), 179 connect( mView, SIGNAL( modifiedChanged( bool ) ),
180 SLOT( slotModifiedChanged( bool ) ) ); 180 SLOT( slotModifiedChanged( bool ) ) );
181 181
182 182
183 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) ); 183 connect( &mSaveTimer, SIGNAL( timeout() ), SLOT( save() ) );
184 mView->setModified( false ); 184 mView->setModified( false );
185 mBlockAtStartup = false; 185 mBlockAtStartup = false;
186 mView->setModified( false ); 186 mView->setModified( false );
187 setCentralWidget( mView ); 187 setCentralWidget( mView );
188 globalFlagBlockStartup = 0; 188 globalFlagBlockStartup = 0;
189 mView->show(); 189 mView->show();
190 delete splash; 190 delete splash;
191 if ( newFile ) 191 if ( newFile )
192 mView->updateConfig(); 192 mView->updateConfig();
193 // qApp->processEvents(); 193 // qApp->processEvents();
194 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ()); 194 //qDebug("MainView x %d y %d w %d h %d", mView->x(),mView-> y(), mView->width(), mView->height ());
195 fillSyncMenu(); 195 fillSyncMenu();
196 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins ); 196 mView->viewManager()->agendaView()->setStartHour( KOPrefs::instance()->mDayBegins );
197 if ( showWarning ) { 197 if ( showWarning ) {
198 KMessageBox::information( this, 198 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"); 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 qApp->processEvents(); 200 qApp->processEvents();
201 mView->dialogManager()->showSyncOptions(); 201 mView->dialogManager()->showSyncOptions();
202 } 202 }
203 203
204 //US listen for result adressed from Ka/Pi 204 //US listen for result adressed from Ka/Pi
205 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & ))); 205 connect(qApp, SIGNAL (appMessage ( const QCString &, const QByteArray & )), ExternalAppHandler::instance(), SLOT (appMessage ( const QCString &, const QByteArray & )));
206} 206}
207MainWindow::~MainWindow() 207MainWindow::~MainWindow()
208{ 208{
209 //qDebug("MainWindow::~MainWindow() "); 209 //qDebug("MainWindow::~MainWindow() ");
210 //save toolbar location 210 //save toolbar location
211 211
212 delete mCalendar; 212 delete mCalendar;
213 delete KOPrefs::instance(); 213 delete KOPrefs::instance();
214 delete KIncidenceFormatter::instance(); 214 delete KIncidenceFormatter::instance();
215 215
216 216
217} 217}
218void MainWindow::showMaximized ()
219{
220#ifndef DESKTOP_VERSION
221 if ( ! globalFlagBlockStartup )
222 mView->goToday();
223#endif
224 QWidget::showMaximized () ;
225}
218void MainWindow::closeEvent( QCloseEvent* ce ) 226void MainWindow::closeEvent( QCloseEvent* ce )
219{ 227{
220 228
221 229
222 230
223 if ( ! KOPrefs::instance()->mAskForQuit ) { 231 if ( ! KOPrefs::instance()->mAskForQuit ) {
224 saveOnClose(); 232 saveOnClose();
225 ce->accept(); 233 ce->accept();
226 return; 234 return;
227 235
228 } 236 }
229 237
230 switch( QMessageBox::information( this, "KO/Pi", 238 switch( QMessageBox::information( this, "KO/Pi",
231 i18n("Do you really want\nto close KO/Pi?"), 239 i18n("Do you really want\nto close KO/Pi?"),
232 i18n("Close"), i18n("No"), 240 i18n("Close"), i18n("No"),
233 0, 0 ) ) { 241 0, 0 ) ) {
234 case 0: 242 case 0:
235 saveOnClose(); 243 saveOnClose();
236 ce->accept(); 244 ce->accept();
237 break; 245 break;
238 case 1: 246 case 1:
239 ce->ignore(); 247 ce->ignore();
240 break; 248 break;
241 case 2: 249 case 2:
242 250
243 default: 251 default:
244 break; 252 break;
245 } 253 }
246 254
247 255
248} 256}
249 257
250void MainWindow::recieve( const QCString& cmsg, const QByteArray& data ) 258void MainWindow::recieve( const QCString& cmsg, const QByteArray& data )
251{ 259{
252 QDataStream stream( data, IO_ReadOnly ); 260 QDataStream stream( data, IO_ReadOnly );
253 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" ); 261 // QMessageBox::about( this, "About KOrganizer/Pi", "*" +msg +"*" );
254 //QString datamess; 262 //QString datamess;
255 //qDebug("message "); 263 //qDebug("message ");
256 qDebug("KO: QCOP message received: %s ", cmsg.data() ); 264 qDebug("KO: QCOP message received: %s ", cmsg.data() );
257 265
258 if ( cmsg == "-writeFile" ) { 266 if ( cmsg == "-writeFile" ) {
259 // I made from the "-writeFile" an "-writeAlarm" 267 // I made from the "-writeFile" an "-writeAlarm"
260 mView->viewManager()->showWhatsNextView(); 268 mView->viewManager()->showWhatsNextView();
261 mCalendar->checkAlarmForIncidence( 0, true); 269 mCalendar->checkAlarmForIncidence( 0, true);
262 showMaximized(); 270 showMaximized();
263 raise(); 271 raise();
264 return; 272 return;
265 } 273 }
266 274
267 if ( cmsg == "-writeFile" ) { 275 if ( cmsg == "-writeFile" ) {
268 // I made from the "-writeFile" an "-writeAlarm" 276 // I made from the "-writeFile" an "-writeAlarm"
269 mView->viewManager()->showWhatsNextView(); 277 mView->viewManager()->showWhatsNextView();
270 mCalendar->checkAlarmForIncidence( 0, true); 278 mCalendar->checkAlarmForIncidence( 0, true);
271 showMaximized(); 279 showMaximized();
272 raise(); 280 raise();
273 return; 281 return;
274 282
275 } 283 }
276 if ( cmsg == "-writeFileSilent" ) { 284 if ( cmsg == "-writeFileSilent" ) {
277 // I made from the "-writeFile" an "-writeAlarm" 285 // I made from the "-writeFile" an "-writeAlarm"
278 // mView->viewManager()->showWhatsNextView(); 286 // mView->viewManager()->showWhatsNextView();
279 mCalendar->checkAlarmForIncidence( 0, true); 287 mCalendar->checkAlarmForIncidence( 0, true);
280 //showMaximized(); 288 //showMaximized();
281 //raise(); 289 //raise();
282 hide(); 290 hide();
283 return; 291 return;
284 } 292 }
285 if ( cmsg == "-newCountdown" ) { 293 if ( cmsg == "-newCountdown" ) {
286 qDebug("newCountdown "); 294 qDebug("newCountdown ");
287 295
288 } 296 }
289 QString msg ; 297 QString msg ;
290 QString allmsg = cmsg; 298 QString allmsg = cmsg;
291 while ( allmsg.length() > 0 ) { 299 while ( allmsg.length() > 0 ) {
292 int nextC = allmsg.find( "-", 1 ); 300 int nextC = allmsg.find( "-", 1 );
293 if ( nextC == -1 ) { 301 if ( nextC == -1 ) {
294 msg = allmsg; 302 msg = allmsg;
295 allmsg = ""; 303 allmsg = "";
296 } else{ 304 } else{
297 msg = allmsg.left( nextC ); 305 msg = allmsg.left( nextC );
298 allmsg = allmsg.mid( nextC, allmsg.length()-nextC ); 306 allmsg = allmsg.mid( nextC, allmsg.length()-nextC );
299 } 307 }
300 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() ); 308 //qDebug("msg: %s all: %s ", msg.latin1(), allmsg.latin1() );
301 if ( msg == "-newEvent" ) { 309 if ( msg == "-newEvent" ) {
302 mView->newEvent(); 310 mView->newEvent();
303 } 311 }
304 if ( msg == "-newTodo" ) { 312 if ( msg == "-newTodo" ) {
305 mView->newTodo(); 313 mView->newTodo();
306 314
307 } 315 }
308 if ( msg == "-showWN" ) { 316 if ( msg == "-showWN" ) {
309 mView->viewManager()->showWhatsNextView(); 317 mView->viewManager()->showWhatsNextView();
310 } 318 }
311 if ( msg == "-showTodo" ) { 319 if ( msg == "-showTodo" ) {
312 mView->viewManager()->showTodoView(); 320 mView->viewManager()->showTodoView();
313 } 321 }
314 if ( msg == "-showList" ) { 322 if ( msg == "-showList" ) {
315 mView->viewManager()->showListView(); 323 mView->viewManager()->showListView();
316 } 324 }
317 else if ( msg == "-showDay" ) { 325 else if ( msg == "-showDay" ) {
318 mView->viewManager()->showDayView(); 326 mView->viewManager()->showDayView();
319 } 327 }
320 else if ( msg == "-showWWeek" ) { 328 else if ( msg == "-showWWeek" ) {
321 mView->viewManager()->showWorkWeekView(); 329 mView->viewManager()->showWorkWeekView();
322 } 330 }
323 else if ( msg == "-ringSync" ) { 331 else if ( msg == "-ringSync" ) {
324 multiSync( false ); 332 multiSync( false );
325 } 333 }
326 else if ( msg == "-showWeek" ) { 334 else if ( msg == "-showWeek" ) {
327 mView->viewManager()->showWeekView(); 335 mView->viewManager()->showWeekView();
328 } 336 }
329 else if ( msg == "-showTodo" ) { 337 else if ( msg == "-showTodo" ) {
330 mView->viewManager()->showTodoView(); 338 mView->viewManager()->showTodoView();
331 } 339 }
332 else if ( msg == "-showJournal" ) { 340 else if ( msg == "-showJournal" ) {
333 mView->dateNavigator()->selectDates( 1 ); 341 mView->dateNavigator()->selectDates( 1 );
334 mView->dateNavigator()->selectToday(); 342 mView->dateNavigator()->selectToday();
335 mView->viewManager()->showJournalView(); 343 mView->viewManager()->showJournalView();
336 } 344 }
337 else if ( msg == "-showKO" ) { 345 else if ( msg == "-showKO" ) {
338 mView->viewManager()->showNextXView(); 346 mView->viewManager()->showNextXView();
339 } 347 }
340 else if ( msg == "-showWNext" || msg == "nextView()" ) { 348 else if ( msg == "-showWNext" || msg == "nextView()" ) {
341 mView->viewManager()->showWhatsNextView(); 349 mView->viewManager()->showWhatsNextView();
342 } 350 }
343 else if ( msg == "-showNextXView" ) { 351 else if ( msg == "-showNextXView" ) {
344 mView->viewManager()->showNextXView(); 352 mView->viewManager()->showNextXView();
345 } 353 }
346 354
347 355
348 } 356 }
349 357
350 showMaximized(); 358 showMaximized();
351 raise(); 359 raise();
352} 360}
353 361
354QPixmap MainWindow::loadPixmap( QString name ) 362QPixmap MainWindow::loadPixmap( QString name )
355{ 363{
356 return SmallIcon( name ); 364 return SmallIcon( name );
357 365
358} 366}
359void MainWindow::initActions() 367void MainWindow::initActions()
360{ 368{
361 //KOPrefs::instance()->mShowFullMenu 369 //KOPrefs::instance()->mShowFullMenu
362 iconToolBar->clear(); 370 iconToolBar->clear();
363 KOPrefs *p = KOPrefs::instance(); 371 KOPrefs *p = KOPrefs::instance();
364 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar ); 372 //QPEMenuBar *menuBar1;// = new QPEMenuBar( iconToolBar );
365 373
366 QPopupMenu *viewMenu = new QPopupMenu( this ); 374 QPopupMenu *viewMenu = new QPopupMenu( this );
367 QPopupMenu *actionMenu = new QPopupMenu( this ); 375 QPopupMenu *actionMenu = new QPopupMenu( this );
368 QPopupMenu *importMenu = new QPopupMenu( this ); 376 QPopupMenu *importMenu = new QPopupMenu( this );
369 selectFilterMenu = new QPopupMenu( this ); 377 selectFilterMenu = new QPopupMenu( this );
370 selectFilterMenu->setCheckable( true ); 378 selectFilterMenu->setCheckable( true );
371 syncMenu = new QPopupMenu( this ); 379 syncMenu = new QPopupMenu( this );
372 configureAgendaMenu = new QPopupMenu( this ); 380 configureAgendaMenu = new QPopupMenu( this );
373 configureToolBarMenu = new QPopupMenu( this ); 381 configureToolBarMenu = new QPopupMenu( this );
374 QPopupMenu *helpMenu = new QPopupMenu( this ); 382 QPopupMenu *helpMenu = new QPopupMenu( this );
375 if ( KOPrefs::instance()->mShowFullMenu ) { 383 if ( KOPrefs::instance()->mShowFullMenu ) {
376 QMenuBar *menuBar1; 384 QMenuBar *menuBar1;
377 menuBar1 = menuBar(); 385 menuBar1 = menuBar();
378 menuBar1->insertItem( i18n("File"), importMenu ); 386 menuBar1->insertItem( i18n("File"), importMenu );
379 menuBar1->insertItem( i18n("View"), viewMenu ); 387 menuBar1->insertItem( i18n("View"), viewMenu );
380 menuBar1->insertItem( i18n("Actions"), actionMenu ); 388 menuBar1->insertItem( i18n("Actions"), actionMenu );
381 menuBar1->insertItem( i18n("Synchronize"), syncMenu ); 389 menuBar1->insertItem( i18n("Synchronize"), syncMenu );
382 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 390 menuBar1->insertItem( i18n("AgendaSize"),configureAgendaMenu );
383 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu ); 391 //menuBar1->insertItem( i18n("Toolbar"),configureToolBarMenu );
384 menuBar1->insertItem( i18n("Filter"),selectFilterMenu ); 392 menuBar1->insertItem( i18n("Filter"),selectFilterMenu );
385 menuBar1->insertItem( i18n("Help"), helpMenu ); 393 menuBar1->insertItem( i18n("Help"), helpMenu );
386 } else { 394 } else {
387 QPEMenuBar *menuBar1; 395 QPEMenuBar *menuBar1;
388 menuBar1 = new QPEMenuBar( iconToolBar ); 396 menuBar1 = new QPEMenuBar( iconToolBar );
389 QPopupMenu *menuBar = new QPopupMenu( this ); 397 QPopupMenu *menuBar = new QPopupMenu( this );
390 menuBar1->insertItem( i18n("ME"), menuBar); 398 menuBar1->insertItem( i18n("ME"), menuBar);
391 menuBar->insertItem( i18n("File"), importMenu ); 399 menuBar->insertItem( i18n("File"), importMenu );
392 menuBar->insertItem( i18n("View"), viewMenu ); 400 menuBar->insertItem( i18n("View"), viewMenu );
393 menuBar->insertItem( i18n("Actions"), actionMenu ); 401 menuBar->insertItem( i18n("Actions"), actionMenu );
394 menuBar->insertItem( i18n("Synchronize"), syncMenu ); 402 menuBar->insertItem( i18n("Synchronize"), syncMenu );
395 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu ); 403 menuBar->insertItem( i18n("AgendaSize"),configureAgendaMenu );
396 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu ); 404 menuBar->insertItem( i18n("Toolbar"),configureToolBarMenu );
397 menuBar->insertItem( i18n("Filter"),selectFilterMenu ); 405 menuBar->insertItem( i18n("Filter"),selectFilterMenu );
398 menuBar->insertItem( i18n("Help"), helpMenu ); 406 menuBar->insertItem( i18n("Help"), helpMenu );
399 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() ); 407 //menuBar1->setMaximumWidth( menuBar1->sizeHint().width() );
400 menuBar1->setMaximumSize( menuBar1->sizeHint( )); 408 menuBar1->setMaximumSize( menuBar1->sizeHint( ));
401 } 409 }
402 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) ); 410 connect ( syncMenu, SIGNAL( activated ( int ) ), this, SLOT (slotSyncMenu( int ) ) );
403 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) ); 411 connect ( selectFilterMenu, SIGNAL( activated ( int ) ), this, SLOT (selectFilter( int ) ) );
404 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) ); 412 connect ( selectFilterMenu, SIGNAL( aboutToShow () ), this, SLOT (fillFilterMenu() ) );
405 413
406 // ****************** 414 // ******************
407 QAction *action; 415 QAction *action;
408 QIconSet icon; 416 QIconSet icon;
409 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 417 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
410 configureToolBarMenu->setCheckable( true ); 418 configureToolBarMenu->setCheckable( true );
411 419
412 QString pathString = ""; 420 QString pathString = "";
413 if ( !p->mToolBarMiniIcons ) { 421 if ( !p->mToolBarMiniIcons ) {
414 if ( QApplication::desktop()->width() < 480 ) 422 if ( QApplication::desktop()->width() < 480 )
415 pathString += "icons16/"; 423 pathString += "icons16/";
416 } else 424 } else
417 pathString += "iconsmini/"; 425 pathString += "iconsmini/";
418 configureAgendaMenu->setCheckable( true ); 426 configureAgendaMenu->setCheckable( true );
419 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 ); 427 configureAgendaMenu->insertItem(i18n("Toggle Allday"), 1 );
420 configureAgendaMenu->insertSeparator(); 428 configureAgendaMenu->insertSeparator();
421 configureAgendaMenu->insertItem(i18n("Tiny"), 4 ); 429 configureAgendaMenu->insertItem(i18n("Tiny"), 4 );
422 configureAgendaMenu->insertItem(i18n("Small"), 6 ); 430 configureAgendaMenu->insertItem(i18n("Small"), 6 );
423 configureAgendaMenu->insertItem(i18n("Medium"), 8 ); 431 configureAgendaMenu->insertItem(i18n("Medium"), 8 );
424 configureAgendaMenu->insertItem(i18n("Normal"), 10 ); 432 configureAgendaMenu->insertItem(i18n("Normal"), 10 );
425 configureAgendaMenu->insertItem(i18n("Large"), 12 ); 433 configureAgendaMenu->insertItem(i18n("Large"), 12 );
426 configureAgendaMenu->insertItem(i18n("Big"), 14 ); 434 configureAgendaMenu->insertItem(i18n("Big"), 14 );
427 configureAgendaMenu->insertItem(i18n("Bigger"), 16 ); 435 configureAgendaMenu->insertItem(i18n("Bigger"), 16 );
428 configureAgendaMenu->insertItem(i18n("Biggest"), 18 ); 436 configureAgendaMenu->insertItem(i18n("Biggest"), 18 );
429 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu ); 437 //configureMenu->insertItem( "AgendaSize",configureAgendaMenu );
430 438
431 icon = loadPixmap( pathString + "configure" ); 439 icon = loadPixmap( pathString + "configure" );
432 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this ); 440 action = new QAction( i18n("Configure"),icon, i18n("Configure..."), 0, this );
433 action->addTo( actionMenu ); 441 action->addTo( actionMenu );
434 connect( action, SIGNAL( activated() ), 442 connect( action, SIGNAL( activated() ),
435 mView, SLOT( edit_options() ) ); 443 mView, SLOT( edit_options() ) );
436 actionMenu->insertSeparator(); 444 actionMenu->insertSeparator();
437 icon = loadPixmap( pathString + "newevent" ); 445 icon = loadPixmap( pathString + "newevent" );
438 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 ); 446 configureToolBarMenu->insertItem(i18n("Stretched TB"), 5 );
439 configureToolBarMenu->insertSeparator(); 447 configureToolBarMenu->insertSeparator();
440 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 ); 448 configureToolBarMenu->insertItem(icon, i18n("New Event..."), 10 );
441 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this ); 449 QAction* ne_action = new QAction( i18n("New Event..."), icon, i18n("New Event..."), 0, this );
442 ne_action->addTo( actionMenu ); 450 ne_action->addTo( actionMenu );
443 connect( ne_action, SIGNAL( activated() ), 451 connect( ne_action, SIGNAL( activated() ),
444 mView, SLOT( newEvent() ) ); 452 mView, SLOT( newEvent() ) );
445 icon = loadPixmap( pathString + "newtodo" ); 453 icon = loadPixmap( pathString + "newtodo" );
446 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 ); 454 configureToolBarMenu->insertItem(icon, i18n("New Todo..."), 20 );
447 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this ); 455 QAction* nt_action = new QAction( i18n("New Todo..."), icon, i18n("New Todo..."), 0, this );
448 nt_action->addTo( actionMenu ); 456 nt_action->addTo( actionMenu );
449 connect( nt_action, SIGNAL( activated() ), 457 connect( nt_action, SIGNAL( activated() ),
450 mView, SLOT( newTodo() ) ); 458 mView, SLOT( newTodo() ) );
451 icon = loadPixmap( pathString + "navi" ); 459 icon = loadPixmap( pathString + "navi" );
452 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this ); 460 action = new QAction( i18n("Toggle DateNavigator"), icon, i18n("Toggle DateNavigator"), 0, this );
453 action->addTo( viewMenu ); 461 action->addTo( viewMenu );
454 connect( action, SIGNAL( activated() ), 462 connect( action, SIGNAL( activated() ),
455 mView, SLOT( toggleDateNavigatorWidget() ) ); 463 mView, SLOT( toggleDateNavigatorWidget() ) );
456 icon = loadPixmap( pathString + "filter" ); 464 icon = loadPixmap( pathString + "filter" );
457 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this ); 465 action = new QAction( i18n("Toggle FilterView"), icon, i18n("Toggle FilterView"), 0, this );
458 action->addTo( viewMenu ); 466 action->addTo( viewMenu );
459 connect( action, SIGNAL( activated() ), 467 connect( action, SIGNAL( activated() ),
460 mView, SLOT( toggleFilter() ) ); 468 mView, SLOT( toggleFilter() ) );
461 469
462 470
463 viewMenu->insertSeparator(); 471 viewMenu->insertSeparator();
464 icon = loadPixmap( pathString + "picker" ); 472 icon = loadPixmap( pathString + "picker" );
465 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this ); 473 action = new QAction( i18n("Date Picker"), icon, i18n("Date Picker"), 0, this );
466 action->addTo( viewMenu ); 474 action->addTo( viewMenu );
467 connect( action, SIGNAL( activated() ), 475 connect( action, SIGNAL( activated() ),
468 mView, SLOT( showDatePicker() ) ); 476 mView, SLOT( showDatePicker() ) );
469 action->addTo( iconToolBar ); 477 action->addTo( iconToolBar );
470 viewMenu->insertSeparator(); 478 viewMenu->insertSeparator();
471 icon = loadPixmap( pathString + "list" ); 479 icon = loadPixmap( pathString + "list" );
472 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 ); 480 configureToolBarMenu->insertItem(icon, i18n("List View"), 30 );
473 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this ); 481 QAction* showlist_action = new QAction( i18n("List View"), icon, i18n("List View"), 0, this );
474 showlist_action->addTo( viewMenu ); 482 showlist_action->addTo( viewMenu );
475 connect( showlist_action, SIGNAL( activated() ), 483 connect( showlist_action, SIGNAL( activated() ),
476 mView->viewManager(), SLOT( showListView() ) ); 484 mView->viewManager(), SLOT( showListView() ) );
477 485
478 486
479 icon = loadPixmap( pathString + "day" ); 487 icon = loadPixmap( pathString + "day" );
480 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 ); 488 configureToolBarMenu->insertItem(icon, i18n("Day View"), 40 );
481 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this ); 489 QAction* day1_action = new QAction( i18n("Day View"), icon, i18n("Day View"), 0, this );
482 day1_action->addTo( viewMenu ); 490 day1_action->addTo( viewMenu );
483 // action->addTo( toolBar ); 491 // action->addTo( toolBar );
484 connect( day1_action, SIGNAL( activated() ), 492 connect( day1_action, SIGNAL( activated() ),
485 mView->viewManager(), SLOT( showDayView() ) ); 493 mView->viewManager(), SLOT( showDayView() ) );
486 494
487 icon = loadPixmap( pathString + "workweek" ); 495 icon = loadPixmap( pathString + "workweek" );
488 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 ); 496 configureToolBarMenu->insertItem(icon, i18n("Work Week"), 50 );
489 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this ); 497 QAction* day5_action = new QAction( i18n("Work Week"), icon, i18n("Work Week"), 0, this );
490 day5_action->addTo( viewMenu ); 498 day5_action->addTo( viewMenu );
491 connect( day5_action, SIGNAL( activated() ), 499 connect( day5_action, SIGNAL( activated() ),
492 mView->viewManager(), SLOT( showWorkWeekView() ) ); 500 mView->viewManager(), SLOT( showWorkWeekView() ) );
493 501
494 icon = loadPixmap( pathString + "week" ); 502 icon = loadPixmap( pathString + "week" );
495 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 ); 503 configureToolBarMenu->insertItem(icon, i18n("Week"), 60 );
496 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this ); 504 QAction* day7_action = new QAction( i18n("Week"), icon, i18n("Week"), 0, this );
497 day7_action->addTo( viewMenu ); 505 day7_action->addTo( viewMenu );
498 connect( day7_action, SIGNAL( activated() ), 506 connect( day7_action, SIGNAL( activated() ),
499 mView->viewManager(), SLOT( showWeekView() ) ); 507 mView->viewManager(), SLOT( showWeekView() ) );
500 508
501 icon = loadPixmap( pathString + "month" ); 509 icon = loadPixmap( pathString + "month" );
502 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 ); 510 configureToolBarMenu->insertItem(icon, i18n("Month"), 70 );
503 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this ); 511 QAction* month_action = new QAction( i18n("Month"), icon, i18n("Month"), 0, this );
504 month_action->addTo( viewMenu ); 512 month_action->addTo( viewMenu );
505 connect( month_action, SIGNAL( activated() ), 513 connect( month_action, SIGNAL( activated() ),
506 mView->viewManager(), SLOT( showMonthView() ) ); 514 mView->viewManager(), SLOT( showMonthView() ) );
507 515
508 icon = loadPixmap( pathString + "todo" ); 516 icon = loadPixmap( pathString + "todo" );
509 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 ); 517 configureToolBarMenu->insertItem(icon, i18n("Todo View"), 80 );
510 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this ); 518 QAction* todoview_action = new QAction( i18n("Todo View"), icon, i18n("Todo View"), 0, this );
511 todoview_action->addTo( viewMenu ); 519 todoview_action->addTo( viewMenu );
512 connect( todoview_action, SIGNAL( activated() ), 520 connect( todoview_action, SIGNAL( activated() ),
513 mView->viewManager(), SLOT( showTodoView() ) ); 521 mView->viewManager(), SLOT( showTodoView() ) );
514 522
515 icon = loadPixmap( pathString + "journal" ); 523 icon = loadPixmap( pathString + "journal" );
516 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 ); 524 configureToolBarMenu->insertItem(icon, i18n("Journal"), 90 );
517 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this ); 525 QAction* viewjournal_action = new QAction( i18n("Journal"), icon, i18n("Journal"), 0, this );
518 viewjournal_action->addTo( viewMenu ); 526 viewjournal_action->addTo( viewMenu );
519 connect( viewjournal_action, SIGNAL( activated() ), 527 connect( viewjournal_action, SIGNAL( activated() ),
520 mView->viewManager(), SLOT( showJournalView() ) ); 528 mView->viewManager(), SLOT( showJournalView() ) );
521 529
522 icon = loadPixmap( pathString + "xdays" ); 530 icon = loadPixmap( pathString + "xdays" );
523 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 ); 531 configureToolBarMenu->insertItem(icon, i18n("Next days"), 100,4 );
524 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this ); 532 QAction* xdays_action = new QAction( i18n("Next days"), icon, i18n("Next days"), 0, this );
525 xdays_action->addTo( viewMenu ); 533 xdays_action->addTo( viewMenu );
526 connect( xdays_action, SIGNAL( activated() ), 534 connect( xdays_action, SIGNAL( activated() ),
527 mView->viewManager(), SLOT( showNextXView() ) ); 535 mView->viewManager(), SLOT( showNextXView() ) );
528 536
529 icon = loadPixmap( pathString + "whatsnext" ); 537 icon = loadPixmap( pathString + "whatsnext" );
530 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 ); 538 configureToolBarMenu->insertItem(icon, i18n("What's Next"), 110, 4 );
531 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this ); 539 QAction* whatsnext_action = new QAction( i18n("What's Next"), icon, i18n("What's Next"), 0, this );
532 whatsnext_action->addTo( viewMenu ); 540 whatsnext_action->addTo( viewMenu );
533 connect( whatsnext_action, SIGNAL( activated() ), 541 connect( whatsnext_action, SIGNAL( activated() ),
534 mView->viewManager(), SLOT( showWhatsNextView() ) ); 542 mView->viewManager(), SLOT( showWhatsNextView() ) );
535 543
536#if 0 544#if 0
537 action = new QAction( "view_timespan", "Time Span", 0, this ); 545 action = new QAction( "view_timespan", "Time Span", 0, this );
538 action->addTo( viewMenu ); 546 action->addTo( viewMenu );
539 connect( action, SIGNAL( activated() ), 547 connect( action, SIGNAL( activated() ),
540 mView->viewManager(), SLOT( showTimeSpanView() ) ); 548 mView->viewManager(), SLOT( showTimeSpanView() ) );
541#endif 549#endif
542 550
543 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0, 551 mNewSubTodoAction = new QAction( "new_subtodo", i18n("New Sub-Todo..."), 0,
544 this ); 552 this );
545 mNewSubTodoAction->addTo( actionMenu ); 553 mNewSubTodoAction->addTo( actionMenu );
546 connect( mNewSubTodoAction, SIGNAL( activated() ), 554 connect( mNewSubTodoAction, SIGNAL( activated() ),
547 mView, SLOT( newSubTodo() ) ); 555 mView, SLOT( newSubTodo() ) );
548 556
549 actionMenu->insertSeparator(); 557 actionMenu->insertSeparator();
550 558
551 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this ); 559 mShowAction = new QAction( "show_incidence", i18n("Show..."), 0, this );
552 mShowAction->addTo( actionMenu ); 560 mShowAction->addTo( actionMenu );
553 connect( mShowAction, SIGNAL( activated() ), 561 connect( mShowAction, SIGNAL( activated() ),
554 mView, SLOT( showIncidence() ) ); 562 mView, SLOT( showIncidence() ) );
555 563
556 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this ); 564 mEditAction = new QAction( "edit_incidence", i18n("Edit..."), 0, this );
557 mEditAction->addTo( actionMenu ); 565 mEditAction->addTo( actionMenu );
558 connect( mEditAction, SIGNAL( activated() ), 566 connect( mEditAction, SIGNAL( activated() ),
559 mView, SLOT( editIncidence() ) ); 567 mView, SLOT( editIncidence() ) );
560 568
561 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this ); 569 mDeleteAction = new QAction( "delete_incidence", i18n("Delete..."), 0, this );
562 mDeleteAction->addTo( actionMenu ); 570 mDeleteAction->addTo( actionMenu );
563 connect( mDeleteAction, SIGNAL( activated() ), 571 connect( mDeleteAction, SIGNAL( activated() ),
564 mView, SLOT( deleteIncidence() ) ); 572 mView, SLOT( deleteIncidence() ) );
565 573
566 actionMenu->insertSeparator(); 574 actionMenu->insertSeparator();
567 575
568 action = new QAction( "purge_completed", i18n("Purge Completed"), 0, 576 action = new QAction( "purge_completed", i18n("Purge Completed"), 0,
569 this ); 577 this );
570 action->addTo( actionMenu ); 578 action->addTo( actionMenu );
571 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) ); 579 connect( action, SIGNAL( activated() ), mView, SLOT( purgeCompleted() ) );
572 580
573 icon = loadPixmap( pathString + "search" ); 581 icon = loadPixmap( pathString + "search" );
574 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this ); 582 QAction* search_action = new QAction( i18n("Search"), icon, i18n("Search..."), 0, this );
575 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4); 583 configureToolBarMenu->insertItem(icon, i18n("Search"), 120 , 4);
576 search_action->addTo( actionMenu ); 584 search_action->addTo( actionMenu );
577 connect( search_action, SIGNAL( activated() ), 585 connect( search_action, SIGNAL( activated() ),
578 mView->dialogManager(), SLOT( showSearchDialog() ) ); 586 mView->dialogManager(), SLOT( showSearchDialog() ) );
579 587
580 icon = loadPixmap( pathString + "today" ); 588 icon = loadPixmap( pathString + "today" );
581 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130); 589 configureToolBarMenu->insertItem(icon, i18n("Go to Today"), 130);
582 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this ); 590 QAction* today_action = new QAction( i18n("Go to Today"), icon, i18n("Go to Today"), 0, this );
583 today_action->addTo( actionMenu ); 591 today_action->addTo( actionMenu );
584 connect( today_action, SIGNAL( activated() ), 592 connect( today_action, SIGNAL( activated() ),
585 mView, SLOT( goToday() ) ); 593 mView, SLOT( goToday() ) );
586 594
587 if ( KOPrefs::instance()->mShowFullMenu ) { 595 if ( KOPrefs::instance()->mShowFullMenu ) {
588 actionMenu->insertSeparator(); 596 actionMenu->insertSeparator();
589 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu ); 597 actionMenu->insertItem( i18n("Configure Toolbar"),configureToolBarMenu );
590 598
591 } 599 }
592 // actionMenu->insertSeparator(); 600 // actionMenu->insertSeparator();
593 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0, 601 action = new QAction( "import_qtopia", i18n("Import (*.ics/*.vcs) file"), 0,
594 this ); 602 this );
595 action->addTo( importMenu ); 603 action->addTo( importMenu );
596 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) ); 604 connect( action, SIGNAL( activated() ), SLOT( importIcal() ) );
597 action = new QAction( "import_quick", i18n("Import last file"), 0, 605 action = new QAction( "import_quick", i18n("Import last file"), 0,
598 this ); 606 this );
599 action->addTo( importMenu ); 607 action->addTo( importMenu );
600 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) ); 608 connect( action, SIGNAL( activated() ), SLOT( quickImportIcal() ) );
601 importMenu->insertSeparator(); 609 importMenu->insertSeparator();
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 1d87db0..3e854cb 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -1,121 +1,122 @@
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 void configureAgenda( int ); 35 void configureAgenda( int );
35 void recieve( const QCString& msg, const QByteArray& data ); 36 void recieve( const QCString& msg, const QByteArray& data );
36 static QString defaultFileName(); 37 static QString defaultFileName();
37 static QString resourcePath(); 38 static QString resourcePath();
38 protected slots: 39 protected slots:
39 void setCaptionToDates(); 40 void setCaptionToDates();
40 int ringSync(); 41 int ringSync();
41 void multiSync( bool askforPrefs = false ); 42 void multiSync( bool askforPrefs = false );
42 void about(); 43 void about();
43 void licence(); 44 void licence();
44 void faq(); 45 void faq();
45 void usertrans(); 46 void usertrans();
46 void features(); 47 void features();
47 void synchowto(); 48 void synchowto();
48 void whatsNew(); 49 void whatsNew();
49 void keyBindings(); 50 void keyBindings();
50 void aboutAutoSaving();; 51 void aboutAutoSaving();;
51 void aboutKnownBugs(); 52 void aboutKnownBugs();
52 53
53 void processIncidenceSelection( Incidence * ); 54 void processIncidenceSelection( Incidence * );
54 55
55 void importQtopia(); 56 void importQtopia();
56 void importBday(); 57 void importBday();
57 void importOL(); 58 void importOL();
58 void importIcal(); 59 void importIcal();
59 void importFile( QString, bool ); 60 void importFile( QString, bool );
60 void quickImportIcal(); 61 void quickImportIcal();
61 62
62 void slotModifiedChanged( bool ); 63 void slotModifiedChanged( bool );
63 64
64 void save(); 65 void save();
65 void configureToolBar( int ); 66 void configureToolBar( int );
66 void printSel(); 67 void printSel();
67 void printCal(); 68 void printCal();
68 void saveCalendar(); 69 void saveCalendar();
69 void loadCalendar(); 70 void loadCalendar();
70 void exportVCalendar(); 71 void exportVCalendar();
71 void fillFilterMenu(); 72 void fillFilterMenu();
72 void selectFilter( int ); 73 void selectFilter( int );
73 74
74 void slotSyncMenu( int ); 75 void slotSyncMenu( int );
75 void syncSSH(); 76 void syncSSH();
76 void confSync(); 77 void confSync();
77 void syncSharp(); 78 void syncSharp();
78 void syncPhone(); 79 void syncPhone();
79 void syncLocalFile(); 80 void syncLocalFile();
80 bool syncWithFile( QString, bool ); 81 bool syncWithFile( QString, bool );
81 void quickSyncLocalFile(); 82 void quickSyncLocalFile();
82 83
83 84
84 protected: 85 protected:
85 void displayText( QString, QString); 86 void displayText( QString, QString);
86 void displayFile( QString, QString); 87 void displayFile( QString, QString);
87 88
88 void enableIncidenceActions( bool ); 89 void enableIncidenceActions( bool );
89 90
90 private: 91 private:
91 void saveOnClose(); 92 void saveOnClose();
92 int mCurrentSyncProfile; 93 int mCurrentSyncProfile;
93 void syncRemote( KSyncProfile* , bool ask = true); 94 void syncRemote( KSyncProfile* , bool ask = true);
94 void fillSyncMenu(); 95 void fillSyncMenu();
95 bool mFlagKeyPressed; 96 bool mFlagKeyPressed;
96 bool mBlockAtStartup; 97 bool mBlockAtStartup;
97 QPEToolBar *iconToolBar; 98 QPEToolBar *iconToolBar;
98 void initActions(); 99 void initActions();
99 void setDefaultPreferences(); 100 void setDefaultPreferences();
100 void keyPressEvent ( QKeyEvent * ) ; 101 void keyPressEvent ( QKeyEvent * ) ;
101 void keyReleaseEvent ( QKeyEvent * ) ; 102 void keyReleaseEvent ( QKeyEvent * ) ;
102 QPopupMenu *configureToolBarMenu; 103 QPopupMenu *configureToolBarMenu;
103 QPopupMenu *selectFilterMenu; 104 QPopupMenu *selectFilterMenu;
104 QPopupMenu *configureAgendaMenu, *syncMenu; 105 QPopupMenu *configureAgendaMenu, *syncMenu;
105 CalendarLocal *mCalendar; 106 CalendarLocal *mCalendar;
106 CalendarView *mView; 107 CalendarView *mView;
107 QString getPassword(); 108 QString getPassword();
108 QAction *mNewSubTodoAction; 109 QAction *mNewSubTodoAction;
109 110
110 QAction *mShowAction; 111 QAction *mShowAction;
111 QAction *mEditAction; 112 QAction *mEditAction;
112 QAction *mDeleteAction; 113 QAction *mDeleteAction;
113 void closeEvent( QCloseEvent* ce ); 114 void closeEvent( QCloseEvent* ce );
114 SimpleAlarmClient mAlarmClient; 115 SimpleAlarmClient mAlarmClient;
115 QTimer mSaveTimer; 116 QTimer mSaveTimer;
116 bool mBlockSaveFlag; 117 bool mBlockSaveFlag;
117 bool mCalendarModifiedFlag; 118 bool mCalendarModifiedFlag;
118 QPixmap loadPixmap( QString ); 119 QPixmap loadPixmap( QString );
119}; 120};
120 121
121#endif 122#endif