summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (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,985 +1,993 @@
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();
602 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0, 610 action = new QAction( "import_bday", i18n("Import Birthdays (KA/Pi)"), 0,
603 this ); 611 this );
604 action->addTo( importMenu ); 612 action->addTo( importMenu );
605 connect( action, SIGNAL( activated() ), SLOT( importBday() ) ); 613 connect( action, SIGNAL( activated() ), SLOT( importBday() ) );
606#ifndef DESKTOP_VERSION 614#ifndef DESKTOP_VERSION
607 importMenu->insertSeparator(); 615 importMenu->insertSeparator();
608 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0, 616 action = new QAction( "import_qtopia", i18n("Import Opie/Qtopia Cal."), 0,
609 this ); 617 this );
610 action->addTo( importMenu ); 618 action->addTo( importMenu );
611 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) ); 619 connect( action, SIGNAL( activated() ), SLOT( importQtopia() ) );
612#else 620#else
613#ifdef _WIN32_ 621#ifdef _WIN32_
614 importMenu->insertSeparator(); 622 importMenu->insertSeparator();
615 action = new QAction( "import_ol", i18n("Import from OL"), 0, 623 action = new QAction( "import_ol", i18n("Import from OL"), 0,
616 this ); 624 this );
617 action->addTo( importMenu ); 625 action->addTo( importMenu );
618 connect( action, SIGNAL( activated() ), SLOT( importOL() ) ); 626 connect( action, SIGNAL( activated() ), SLOT( importOL() ) );
619#endif 627#endif
620#endif 628#endif
621 629
622 importMenu->insertSeparator(); 630 importMenu->insertSeparator();
623 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0, 631 action = new QAction( "load_cal", i18n("Load Calendar Backup"), 0,
624 this ); 632 this );
625 action->addTo( importMenu ); 633 action->addTo( importMenu );
626 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) ); 634 connect( action, SIGNAL( activated() ), SLOT( loadCalendar() ) );
627 635
628 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0, 636 action = new QAction( "save_cal", i18n("Save Calendar Backup"), 0,
629 this ); 637 this );
630 action->addTo( importMenu ); 638 action->addTo( importMenu );
631 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) ); 639 connect( action, SIGNAL( activated() ), SLOT( saveCalendar() ) );
632 640
633 importMenu->insertSeparator(); 641 importMenu->insertSeparator();
634 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0, 642 action = new QAction( "import_qtopia", i18n("Export VCalendar"), 0,
635 this ); 643 this );
636 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) ); 644 action->addTo( importMenu ); connect( action, SIGNAL( activated() ), SLOT( exportVCalendar() ) );
637 importMenu->insertSeparator(); 645 importMenu->insertSeparator();
638 action = new QAction( "manage cat", i18n("Manage new categories..."), 0, 646 action = new QAction( "manage cat", i18n("Manage new categories..."), 0,
639 this ); 647 this );
640 action->addTo( importMenu ); 648 action->addTo( importMenu );
641 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) ); 649 connect( action, SIGNAL( activated() ), mView, SLOT( manageCategories() ) );
642#ifndef DESKTOP_VERSION 650#ifndef DESKTOP_VERSION
643 importMenu->insertSeparator(); 651 importMenu->insertSeparator();
644 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0, 652 action = new QAction( "beam all", i18n("Beam complete calendar..."), 0,
645 this ); 653 this );
646 action->addTo( importMenu ); 654 action->addTo( importMenu );
647 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) ); 655 connect( action, SIGNAL( activated() ), mView, SLOT( beamCalendar() ) );
648 656
649 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0, 657 action = new QAction( "beam all", i18n("Beam filtered calendar..."), 0,
650 this ); 658 this );
651 action->addTo( importMenu ); 659 action->addTo( importMenu );
652 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) ); 660 connect( action, SIGNAL( activated() ), mView, SLOT( beamFilteredCalendar()) );
653#else 661#else
654 importMenu->insertSeparator(); 662 importMenu->insertSeparator();
655 icon = loadPixmap( pathString + "print" ); 663 icon = loadPixmap( pathString + "print" );
656 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this ); 664 action = new QAction( i18n("Print calendar..."),icon,i18n("Print calendar..."), 0, this );
657 action->addTo( importMenu ); 665 action->addTo( importMenu );
658 connect( action, SIGNAL( activated() ), 666 connect( action, SIGNAL( activated() ),
659 this, SLOT( printCal() ) ); 667 this, SLOT( printCal() ) );
660 668
661 icon = loadPixmap( pathString + "print" ); 669 icon = loadPixmap( pathString + "print" );
662 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this ); 670 action = new QAction( i18n("Print agenda selection..."),icon,i18n("Print agenda selection..."), 0, this );
663 action->addTo( importMenu ); 671 action->addTo( importMenu );
664 connect( action, SIGNAL( activated() ), 672 connect( action, SIGNAL( activated() ),
665 this, SLOT( printSel() ) ); 673 this, SLOT( printSel() ) );
666#endif 674#endif
667 importMenu->insertSeparator(); 675 importMenu->insertSeparator();
668 action = new QAction( "beam all", i18n("Save"), 0, 676 action = new QAction( "beam all", i18n("Save"), 0,
669 this ); 677 this );
670 action->addTo( importMenu ); 678 action->addTo( importMenu );
671 connect( action, SIGNAL( activated() ), this, SLOT( save() ) ); 679 connect( action, SIGNAL( activated() ), this, SLOT( save() ) );
672 action = new QAction( "beam all", i18n("Exit (+save)"), 0, 680 action = new QAction( "beam all", i18n("Exit (+save)"), 0,
673 this ); 681 this );
674 action->addTo( importMenu ); 682 action->addTo( importMenu );
675 connect( action, SIGNAL( activated() ), this, SLOT( close() ) ); 683 connect( action, SIGNAL( activated() ), this, SLOT( close() ) );
676 684
677 //menuBar->insertItem( "Configure",configureMenu ); 685 //menuBar->insertItem( "Configure",configureMenu );
678 //configureMenu->insertItem( "Toolbar",configureToolBarMenu ); 686 //configureMenu->insertItem( "Toolbar",configureToolBarMenu );
679 icon = loadPixmap( "korganizer/korganizer" ); 687 icon = loadPixmap( "korganizer/korganizer" );
680 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this ); 688 action = new QAction( "Keys + Colors", i18n("Keys + Colors..."), 0, this );
681 action->addTo( helpMenu ); 689 action->addTo( helpMenu );
682 connect( action, SIGNAL( activated() ), 690 connect( action, SIGNAL( activated() ),
683 SLOT( keyBindings() ) ); 691 SLOT( keyBindings() ) );
684 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this ); 692 action = new QAction( "featureHowto", i18n("Features + hints..."), 0,this );
685 action->addTo( helpMenu ); 693 action->addTo( helpMenu );
686 connect( action, SIGNAL( activated() ), 694 connect( action, SIGNAL( activated() ),
687 SLOT( features() ) ); 695 SLOT( features() ) );
688 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this ); 696 action = new QAction( "Auto saving", i18n("Auto saving..."), 0, this );
689 action->addTo( helpMenu ); 697 action->addTo( helpMenu );
690 connect( action, SIGNAL( activated() ), 698 connect( action, SIGNAL( activated() ),
691 SLOT( aboutAutoSaving() ) ); 699 SLOT( aboutAutoSaving() ) );
692 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this ); 700 action = new QAction( "Problemd", i18n("Known Problems..."), 0,this );
693 action->addTo( helpMenu ); 701 action->addTo( helpMenu );
694 connect( action, SIGNAL( activated() ), 702 connect( action, SIGNAL( activated() ),
695 SLOT( aboutKnownBugs() ) ); 703 SLOT( aboutKnownBugs() ) );
696 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this ); 704 action = new QAction( "Translate Howto", i18n("User translation..."), 0,this );
697 action->addTo( helpMenu ); 705 action->addTo( helpMenu );
698 connect( action, SIGNAL( activated() ), 706 connect( action, SIGNAL( activated() ),
699 SLOT( usertrans() ) ); 707 SLOT( usertrans() ) );
700 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this ); 708 action = new QAction( "Sync Howto", i18n("Sync HowTo..."), 0,this );
701 action->addTo( helpMenu ); 709 action->addTo( helpMenu );
702 connect( action, SIGNAL( activated() ), 710 connect( action, SIGNAL( activated() ),
703 SLOT( synchowto() ) ); 711 SLOT( synchowto() ) );
704 action = new QAction( "Whats New", i18n("What's new?"), 0,this ); 712 action = new QAction( "Whats New", i18n("What's new?"), 0,this );
705 action->addTo( helpMenu ); 713 action->addTo( helpMenu );
706 connect( action, SIGNAL( activated() ), 714 connect( action, SIGNAL( activated() ),
707 SLOT( whatsNew() ) ); 715 SLOT( whatsNew() ) );
708 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this ); 716 action = new QAction( "Frequently asked questions", i18n("FAQ..."), 0,this );
709 action->addTo( helpMenu ); 717 action->addTo( helpMenu );
710 connect( action, SIGNAL( activated() ), 718 connect( action, SIGNAL( activated() ),
711 SLOT( faq() ) ); 719 SLOT( faq() ) );
712 720
713 721
714 action = new QAction( "about", i18n("About..."), 0, this ); 722 action = new QAction( "about", i18n("About..."), 0, this );
715 action->addTo( helpMenu ); 723 action->addTo( helpMenu );
716 connect( action, SIGNAL( activated() ), 724 connect( action, SIGNAL( activated() ),
717 SLOT( about() ) ); 725 SLOT( about() ) );
718 action = new QAction( "licence", i18n("Licence..."), 0, this ); 726 action = new QAction( "licence", i18n("Licence..."), 0, this );
719 action->addTo( helpMenu ); 727 action->addTo( helpMenu );
720 connect( action, SIGNAL( activated() ), 728 connect( action, SIGNAL( activated() ),
721 SLOT( licence() ) ); 729 SLOT( licence() ) );
722 //menuBar->insertSeparator(); 730 //menuBar->insertSeparator();
723 731
724 // ****************************************************** 732 // ******************************************************
725 // menubar icons 733 // menubar icons
726 734
727 735
728 iconToolBar->setHorizontalStretchable (true ); 736 iconToolBar->setHorizontalStretchable (true );
729 //menuBar->insertItem( iconToolBar ); 737 //menuBar->insertItem( iconToolBar );
730 //xdays_action 738 //xdays_action
731 if (p-> mShowIconNewEvent) 739 if (p-> mShowIconNewEvent)
732 ne_action->addTo( iconToolBar ); 740 ne_action->addTo( iconToolBar );
733 if (p->mShowIconNewTodo ) 741 if (p->mShowIconNewTodo )
734 nt_action->addTo( iconToolBar ); 742 nt_action->addTo( iconToolBar );
735 if (p-> mShowIconSearch) 743 if (p-> mShowIconSearch)
736 search_action->addTo( iconToolBar ); 744 search_action->addTo( iconToolBar );
737 if (p-> mShowIconNext) 745 if (p-> mShowIconNext)
738 whatsnext_action->addTo( iconToolBar ); 746 whatsnext_action->addTo( iconToolBar );
739 if (p-> mShowIconNextDays) 747 if (p-> mShowIconNextDays)
740 xdays_action->addTo( iconToolBar ); 748 xdays_action->addTo( iconToolBar );
741 if (p-> mShowIconList) 749 if (p-> mShowIconList)
742 showlist_action->addTo( iconToolBar ); 750 showlist_action->addTo( iconToolBar );
743 if (p-> mShowIconDay1) 751 if (p-> mShowIconDay1)
744 day1_action->addTo( iconToolBar ); 752 day1_action->addTo( iconToolBar );
745 if (p-> mShowIconDay5) 753 if (p-> mShowIconDay5)
746 day5_action->addTo( iconToolBar ); 754 day5_action->addTo( iconToolBar );
747 if (p-> mShowIconDay7) 755 if (p-> mShowIconDay7)
748 day7_action->addTo( iconToolBar ); 756 day7_action->addTo( iconToolBar );
749 if (p-> mShowIconMonth) 757 if (p-> mShowIconMonth)
750 month_action->addTo( iconToolBar ); 758 month_action->addTo( iconToolBar );
751 if (p-> mShowIconTodoview) 759 if (p-> mShowIconTodoview)
752 todoview_action->addTo( iconToolBar ); 760 todoview_action->addTo( iconToolBar );
753 if (p-> mShowIconJournal) 761 if (p-> mShowIconJournal)
754 viewjournal_action->addTo( iconToolBar ); 762 viewjournal_action->addTo( iconToolBar );
755 icon = loadPixmap( pathString + "2leftarrowB" ); 763 icon = loadPixmap( pathString + "2leftarrowB" );
756 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14); 764 configureToolBarMenu->insertItem(icon, i18n("Prev. month"), 200, 14);
757 if (p-> mShowIconBackFast) { 765 if (p-> mShowIconBackFast) {
758 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this ); 766 action = new QAction( i18n("Prev. month"), icon, i18n("Prev. month"),0 , this );
759 connect( action, SIGNAL( activated() ), 767 connect( action, SIGNAL( activated() ),
760 mView, SLOT( goPreviousMonth() ) ); 768 mView, SLOT( goPreviousMonth() ) );
761 action->addTo( iconToolBar ); 769 action->addTo( iconToolBar );
762 } 770 }
763 icon = loadPixmap( pathString + "1leftarrowB" ); 771 icon = loadPixmap( pathString + "1leftarrowB" );
764 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15); 772 configureToolBarMenu->insertItem(icon, i18n("Go backward"), 210,15);
765 if (p-> mShowIconBack) { 773 if (p-> mShowIconBack) {
766 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this ); 774 action = new QAction( i18n("Go backward"), icon, i18n("Go backward"),0 , this );
767 connect( action, SIGNAL( activated() ), 775 connect( action, SIGNAL( activated() ),
768 mView, SLOT( goPrevious() ) ); 776 mView, SLOT( goPrevious() ) );
769 action->addTo( iconToolBar ); 777 action->addTo( iconToolBar );
770 } 778 }
771 if (p-> mShowIconToday) 779 if (p-> mShowIconToday)
772 today_action->addTo( iconToolBar ); 780 today_action->addTo( iconToolBar );
773 icon = loadPixmap( pathString + "1rightarrowB" ); 781 icon = loadPixmap( pathString + "1rightarrowB" );
774 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220); 782 configureToolBarMenu->insertItem(icon, i18n("Go forward"), 220);
775 if (p-> mShowIconForward) { 783 if (p-> mShowIconForward) {
776 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this ); 784 action = new QAction( i18n("Go forward"), icon, i18n("Go forward"),0 , this );
777 connect( action, SIGNAL( activated() ), 785 connect( action, SIGNAL( activated() ),
778 mView, SLOT( goNext() ) ); 786 mView, SLOT( goNext() ) );
779 action->addTo( iconToolBar ); 787 action->addTo( iconToolBar );
780 } 788 }
781 icon = loadPixmap( pathString + "2rightarrowB" ); 789 icon = loadPixmap( pathString + "2rightarrowB" );
782 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230); 790 configureToolBarMenu->insertItem(icon, i18n("Next month"), 230);
783 if (p-> mShowIconForwardFast) { 791 if (p-> mShowIconForwardFast) {
784 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this ); 792 action = new QAction( i18n("Next month"), icon, i18n("Next month"),0 , this );
785 connect( action, SIGNAL( activated() ), 793 connect( action, SIGNAL( activated() ),
786 mView, SLOT( goNextMonth() ) ); 794 mView, SLOT( goNextMonth() ) );
787 action->addTo( iconToolBar ); 795 action->addTo( iconToolBar );
788 } 796 }
789 797
790 798
791 configureToolBarMenu->insertItem(i18n("What's This?"), 300); 799 configureToolBarMenu->insertItem(i18n("What's This?"), 300);
792 800
793 if (p-> mShowIconNewEvent) 801 if (p-> mShowIconNewEvent)
794 configureToolBarMenu->setItemChecked( 10, true ); 802 configureToolBarMenu->setItemChecked( 10, true );
795 if (p->mShowIconNewTodo ) 803 if (p->mShowIconNewTodo )
796 configureToolBarMenu->setItemChecked( 20, true ); 804 configureToolBarMenu->setItemChecked( 20, true );
797 if (p-> mShowIconSearch) 805 if (p-> mShowIconSearch)
798 configureToolBarMenu->setItemChecked( 120, true ); 806 configureToolBarMenu->setItemChecked( 120, true );
799 if (p-> mShowIconList) 807 if (p-> mShowIconList)
800 configureToolBarMenu->setItemChecked( 30, true ); 808 configureToolBarMenu->setItemChecked( 30, true );
801 if (p-> mShowIconDay1) 809 if (p-> mShowIconDay1)
802 configureToolBarMenu->setItemChecked( 40, true ); 810 configureToolBarMenu->setItemChecked( 40, true );
803 if (p-> mShowIconDay5) 811 if (p-> mShowIconDay5)
804 configureToolBarMenu->setItemChecked( 50, true ); 812 configureToolBarMenu->setItemChecked( 50, true );
805 if (p-> mShowIconDay7) 813 if (p-> mShowIconDay7)
806 configureToolBarMenu->setItemChecked( 60, true ); 814 configureToolBarMenu->setItemChecked( 60, true );
807 if (p-> mShowIconMonth) 815 if (p-> mShowIconMonth)
808 configureToolBarMenu->setItemChecked( 70, true ); 816 configureToolBarMenu->setItemChecked( 70, true );
809 if (p-> mShowIconTodoview) 817 if (p-> mShowIconTodoview)
810 configureToolBarMenu->setItemChecked( 80, true ); 818 configureToolBarMenu->setItemChecked( 80, true );
811 if (p-> mShowIconBackFast) 819 if (p-> mShowIconBackFast)
812 configureToolBarMenu->setItemChecked( 200, true ); 820 configureToolBarMenu->setItemChecked( 200, true );
813 if (p-> mShowIconBack) 821 if (p-> mShowIconBack)
814 configureToolBarMenu->setItemChecked( 210, true ); 822 configureToolBarMenu->setItemChecked( 210, true );
815 if (p-> mShowIconToday) 823 if (p-> mShowIconToday)
816 configureToolBarMenu->setItemChecked( 130, true ); 824 configureToolBarMenu->setItemChecked( 130, true );
817 if (p-> mShowIconForward) 825 if (p-> mShowIconForward)
818 configureToolBarMenu->setItemChecked( 220, true ); 826 configureToolBarMenu->setItemChecked( 220, true );
819 if (p-> mShowIconForwardFast) 827 if (p-> mShowIconForwardFast)
820 configureToolBarMenu->setItemChecked( 230, true ); 828 configureToolBarMenu->setItemChecked( 230, true );
821 if (p-> mShowIconNextDays) 829 if (p-> mShowIconNextDays)
822 configureToolBarMenu->setItemChecked( 100, true ); 830 configureToolBarMenu->setItemChecked( 100, true );
823 if (p-> mShowIconNext) 831 if (p-> mShowIconNext)
824 configureToolBarMenu->setItemChecked( 110, true ); 832 configureToolBarMenu->setItemChecked( 110, true );
825 if (p-> mShowIconJournal) 833 if (p-> mShowIconJournal)
826 configureToolBarMenu->setItemChecked( 90, true ); 834 configureToolBarMenu->setItemChecked( 90, true );
827 if (p-> mShowIconWhatsThis) 835 if (p-> mShowIconWhatsThis)
828 configureToolBarMenu->setItemChecked( 300, true ); 836 configureToolBarMenu->setItemChecked( 300, true );
829 837
830 QLabel* dummy = new QLabel( iconToolBar ); 838 QLabel* dummy = new QLabel( iconToolBar );
831 dummy->setBackgroundColor( iconToolBar->backgroundColor() ); 839 dummy->setBackgroundColor( iconToolBar->backgroundColor() );
832 if (!p-> mShowIconStretch) 840 if (!p-> mShowIconStretch)
833 iconToolBar->setStretchableWidget ( dummy ) ; 841 iconToolBar->setStretchableWidget ( dummy ) ;
834 else 842 else
835 configureToolBarMenu->setItemChecked( 5, true ); 843 configureToolBarMenu->setItemChecked( 5, true );
836 if (p-> mShowIconWhatsThis) 844 if (p-> mShowIconWhatsThis)
837 QWhatsThis::whatsThisButton ( iconToolBar ); 845 QWhatsThis::whatsThisButton ( iconToolBar );
838 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) ); 846 connect( configureToolBarMenu, SIGNAL( activated( int ) ),this, SLOT(configureToolBar( int ) ) );
839 configureAgenda( p->mHourSize ); 847 configureAgenda( p->mHourSize );
840 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) ); 848 connect( configureAgendaMenu, SIGNAL( activated( int ) ),this, SLOT(configureAgenda( int ) ) );
841} 849}
842void MainWindow::fillSyncMenu() 850void MainWindow::fillSyncMenu()
843{ 851{
844 syncMenu->clear(); 852 syncMenu->clear();
845 syncMenu->insertItem( i18n("Configure..."), 0 ); 853 syncMenu->insertItem( i18n("Configure..."), 0 );
846 syncMenu->insertSeparator(); 854 syncMenu->insertSeparator();
847 syncMenu->insertItem( i18n("Multiple sync"), 1 ); 855 syncMenu->insertItem( i18n("Multiple sync"), 1 );
848 syncMenu->insertSeparator(); 856 syncMenu->insertSeparator();
849 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 857 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
850 config.setGroup("General"); 858 config.setGroup("General");
851 QStringList prof = config.readListEntry("SyncProfileNames"); 859 QStringList prof = config.readListEntry("SyncProfileNames");
852 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined"); 860 KOPrefs::instance()->mLocalMachineName = config.readEntry("LocalMachineName","undefined");
853 if ( prof.count() < 3 ) { 861 if ( prof.count() < 3 ) {
854 prof.clear(); 862 prof.clear();
855 prof << i18n("Sharp_DTM"); 863 prof << i18n("Sharp_DTM");
856 prof << i18n("Local_file"); 864 prof << i18n("Local_file");
857 prof << i18n("Last_file"); 865 prof << i18n("Last_file");
858 KSyncProfile* temp = new KSyncProfile (); 866 KSyncProfile* temp = new KSyncProfile ();
859 temp->setName( prof[0] ); 867 temp->setName( prof[0] );
860 temp->writeConfig(&config); 868 temp->writeConfig(&config);
861 temp->setName( prof[1] ); 869 temp->setName( prof[1] );
862 temp->writeConfig(&config); 870 temp->writeConfig(&config);
863 temp->setName( prof[2] ); 871 temp->setName( prof[2] );
864 temp->writeConfig(&config); 872 temp->writeConfig(&config);
865 config.setGroup("General"); 873 config.setGroup("General");
866 config.writeEntry("SyncProfileNames",prof); 874 config.writeEntry("SyncProfileNames",prof);
867 config.writeEntry("ExternSyncProfiles","Sharp_DTM"); 875 config.writeEntry("ExternSyncProfiles","Sharp_DTM");
868 config.sync(); 876 config.sync();
869 delete temp; 877 delete temp;
870 } 878 }
871 KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles"); 879 KOPrefs::instance()->mExternSyncProfiles = config.readListEntry("ExternSyncProfiles");
872 KOPrefs::instance()->mSyncProfileNames = prof; 880 KOPrefs::instance()->mSyncProfileNames = prof;
873 int i; 881 int i;
874 for ( i = 0; i < prof.count(); ++i ) { 882 for ( i = 0; i < prof.count(); ++i ) {
875 883
876 syncMenu->insertItem( prof[i], 1000+i ); 884 syncMenu->insertItem( prof[i], 1000+i );
877 if ( i == 2 ) 885 if ( i == 2 )
878 syncMenu->insertSeparator(); 886 syncMenu->insertSeparator();
879 } 887 }
880 QDir app_dir; 888 QDir app_dir;
881 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 889 if ( !app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
882 syncMenu->setItemEnabled( false , 1000 ); 890 syncMenu->setItemEnabled( false , 1000 );
883 } 891 }
884 mView->setupExternSyncProfiles(); 892 mView->setupExternSyncProfiles();
885} 893}
886 894
887int MainWindow::ringSync() 895int MainWindow::ringSync()
888{ 896{
889 int syncedProfiles = 0; 897 int syncedProfiles = 0;
890 int i; 898 int i;
891 QTime timer; 899 QTime timer;
892 KConfig config ( locateLocal( "config","syncprofilesrc" ) ); 900 KConfig config ( locateLocal( "config","syncprofilesrc" ) );
893 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames; 901 QStringList syncProfileNames = KOPrefs::instance()->mSyncProfileNames;
894 KSyncProfile* temp = new KSyncProfile (); 902 KSyncProfile* temp = new KSyncProfile ();
895 KOPrefs::instance()->mAskForPreferences = false; 903 KOPrefs::instance()->mAskForPreferences = false;
896 for ( i = 0; i < syncProfileNames.count(); ++i ) { 904 for ( i = 0; i < syncProfileNames.count(); ++i ) {
897 mCurrentSyncProfile = i; 905 mCurrentSyncProfile = i;
898 temp->setName(syncProfileNames[mCurrentSyncProfile]); 906 temp->setName(syncProfileNames[mCurrentSyncProfile]);
899 temp->readConfig(&config); 907 temp->readConfig(&config);
900 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) { 908 if ( temp->getIncludeInRingSync() && ( i < 1 || i > 2 )) {
901 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 909 setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
902 ++syncedProfiles; 910 ++syncedProfiles;
903 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences(); 911 // KOPrefs::instance()->mAskForPreferences = temp->getAskForPreferences();
904 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile(); 912 KOPrefs::instance()->mWriteBackFile = temp->getWriteBackFile();
905 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting(); 913 KOPrefs::instance()->mWriteBackExistingOnly = temp->getWriteBackExisting();
906 KOPrefs::instance()->mShowSyncSummary = false; 914 KOPrefs::instance()->mShowSyncSummary = false;
907 mView->setSyncDevice(syncProfileNames[i] ); 915 mView->setSyncDevice(syncProfileNames[i] );
908 mView->setSyncName( KOPrefs::instance()->mLocalMachineName ); 916 mView->setSyncName( KOPrefs::instance()->mLocalMachineName );
909 if ( i == 0 ) { 917 if ( i == 0 ) {
910 syncSharp(); 918 syncSharp();
911 } else { 919 } else {
912 if ( temp->getIsLocalFileSync() ) { 920 if ( temp->getIsLocalFileSync() ) {
913 if ( syncWithFile( temp->getRemoteFileName( ), true ) ) 921 if ( syncWithFile( temp->getRemoteFileName( ), true ) )
914 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName(); 922 KOPrefs::instance()->mLastSyncedLocalFile = temp->getRemoteFileName();
915 } else { 923 } else {
916 if ( temp->getIsPhoneSync() ) { 924 if ( temp->getIsPhoneSync() ) {
917 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ; 925 KOPrefs::instance()->mPhoneDevice = temp->getPhoneDevice( ) ;
918 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( ); 926 KOPrefs::instance()->mPhoneConnection = temp->getPhoneConnection( );
919 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( ); 927 KOPrefs::instance()->mPhoneModel = temp->getPhoneModel( );
920 syncPhone(); 928 syncPhone();
921 } else 929 } else
922 syncRemote( temp, false ); 930 syncRemote( temp, false );
923 931
924 } 932 }
925 } 933 }
926 timer.start(); 934 timer.start();
927 setCaption(i18n("Multiple sync in progress ... please wait!") ); 935 setCaption(i18n("Multiple sync in progress ... please wait!") );
928 while ( timer.elapsed () < 2000 ) { 936 while ( timer.elapsed () < 2000 ) {
929 qApp->processEvents(); 937 qApp->processEvents();
930#ifndef _WIN32_ 938#ifndef _WIN32_
931 sleep (1); 939 sleep (1);
932#endif 940#endif
933 } 941 }
934 942
935 } 943 }
936 944
937 } 945 }
938 delete temp; 946 delete temp;
939 return syncedProfiles; 947 return syncedProfiles;
940} 948}
941 949
942void MainWindow::multiSync( bool askforPrefs ) 950void MainWindow::multiSync( bool askforPrefs )
943{ 951{
944 if (mBlockSaveFlag) 952 if (mBlockSaveFlag)
945 return; 953 return;
946 mBlockSaveFlag = true; 954 mBlockSaveFlag = true;
947 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 955 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
948 if ( QMessageBox::information( this, i18n("KO/Pi Sync"), 956 if ( QMessageBox::information( this, i18n("KO/Pi Sync"),
949 question, 957 question,
950 i18n("Yes"), i18n("No"), 958 i18n("Yes"), i18n("No"),
951 0, 0 ) != 0 ) { 959 0, 0 ) != 0 ) {
952 mBlockSaveFlag = false; 960 mBlockSaveFlag = false;
953 setCaption(i18n("Aborted! Nothing synced!")); 961 setCaption(i18n("Aborted! Nothing synced!"));
954 return; 962 return;
955 } 963 }
956 mView->setSyncDevice(i18n("Multiple profiles") ); 964 mView->setSyncDevice(i18n("Multiple profiles") );
957 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs; 965 KOPrefs::instance()->mSyncAlgoPrefs = KOPrefs::instance()->mRingSyncAlgoPrefs;
958 if ( askforPrefs ) { 966 if ( askforPrefs ) {
959 mView->edit_sync_options(); 967 mView->edit_sync_options();
960 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs; 968 KOPrefs::instance()->mRingSyncAlgoPrefs = KOPrefs::instance()->mSyncAlgoPrefs;
961 } 969 }
962 setCaption(i18n("Multiple sync started.") ); 970 setCaption(i18n("Multiple sync started.") );
963 qApp->processEvents(); 971 qApp->processEvents();
964 int num = ringSync() ; 972 int num = ringSync() ;
965 if ( num > 1 ) 973 if ( num > 1 )
966 ringSync(); 974 ringSync();
967 mBlockSaveFlag = false; 975 mBlockSaveFlag = false;
968 if ( num ) 976 if ( num )
969 save(); 977 save();
970 if ( num ) 978 if ( num )
971 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); 979 setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
972 else 980 else
973 setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 981 setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
974 return; 982 return;
975} 983}
976void MainWindow::slotSyncMenu( int action ) 984void MainWindow::slotSyncMenu( int action )
977{ 985{
978 //qDebug("syncaction %d ", action); 986 //qDebug("syncaction %d ", action);
979 if ( action == 0 ) { 987 if ( action == 0 ) {
980 988
981 confSync(); 989 confSync();
982 990
983 return; 991 return;
984 } 992 }
985 if ( action == 1 ) { 993 if ( action == 1 ) {
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