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
@@ -122,192 +122,200 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
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 }
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