summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-22 06:39:51 (UTC)
committer zautrix <zautrix>2004-09-22 06:39:51 (UTC)
commitc640aaff31f298b4aff7a61cbdfa9c8a95269479 (patch) (unidiff)
tree3fe1c1d16c63d03e7b1faec540df30b7a8e5c506
parentbbeffa56ee51d30b84bcadaf22234b8227958f31 (diff)
downloadkdepimpi-c640aaff31f298b4aff7a61cbdfa9c8a95269479.zip
kdepimpi-c640aaff31f298b4aff7a61cbdfa9c8a95269479.tar.gz
kdepimpi-c640aaff31f298b4aff7a61cbdfa9c8a95269479.tar.bz2
modified file warning fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp17
-rw-r--r--korganizer/calendarview.h1
-rw-r--r--korganizer/mainwindow.cpp3
3 files changed, 18 insertions, 3 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 3635cfa..eaea040 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1469,138 +1469,151 @@ bool CalendarView::importQtopia( const QString &categories,
1469 1469
1470#endif 1470#endif
1471 1471
1472} 1472}
1473 1473
1474void CalendarView::setSyncEventsReadOnly() 1474void CalendarView::setSyncEventsReadOnly()
1475{ 1475{
1476 Event * ev; 1476 Event * ev;
1477 QPtrList<Event> eL = mCalendar->rawEvents(); 1477 QPtrList<Event> eL = mCalendar->rawEvents();
1478 ev = eL.first(); 1478 ev = eL.first();
1479 while ( ev ) { 1479 while ( ev ) {
1480 if ( ev->uid().left(15) == QString("last-syncEvent-") ) 1480 if ( ev->uid().left(15) == QString("last-syncEvent-") )
1481 ev->setReadOnly( true ); 1481 ev->setReadOnly( true );
1482 ev = eL.next(); 1482 ev = eL.next();
1483 } 1483 }
1484} 1484}
1485bool CalendarView::openCalendar(QString filename, bool merge) 1485bool CalendarView::openCalendar(QString filename, bool merge)
1486{ 1486{
1487 1487
1488 if (filename.isEmpty()) { 1488 if (filename.isEmpty()) {
1489 return false; 1489 return false;
1490 } 1490 }
1491 1491
1492 if (!QFile::exists(filename)) { 1492 if (!QFile::exists(filename)) {
1493 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename)); 1493 KMessageBox::error(this,i18n("File does not exist:\n '%1'.").arg(filename));
1494 return false; 1494 return false;
1495 } 1495 }
1496 1496
1497 globalFlagBlockAgenda = 1; 1497 globalFlagBlockAgenda = 1;
1498 if (!merge) mCalendar->close(); 1498 if (!merge) mCalendar->close();
1499 1499
1500 mStorage->setFileName( filename ); 1500 mStorage->setFileName( filename );
1501 1501
1502 if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) { 1502 if ( mStorage->load(KOPrefs::instance()->mUseQuicksave) ) {
1503 if ( merge ) ;//setModified( true ); 1503 if ( merge ) ;//setModified( true );
1504 else { 1504 else {
1505 //setModified( true ); 1505 //setModified( true );
1506 mViewManager->setDocumentId( filename ); 1506 mViewManager->setDocumentId( filename );
1507 mDialogManager->setDocumentId( filename ); 1507 mDialogManager->setDocumentId( filename );
1508 mTodoList->setDocumentId( filename ); 1508 mTodoList->setDocumentId( filename );
1509 } 1509 }
1510 globalFlagBlockAgenda = 2; 1510 globalFlagBlockAgenda = 2;
1511 // if ( getLastSyncEvent() ) 1511 // if ( getLastSyncEvent() )
1512 // getLastSyncEvent()->setReadOnly( true ); 1512 // getLastSyncEvent()->setReadOnly( true );
1513 mCalendar->reInitAlarmSettings(); 1513 mCalendar->reInitAlarmSettings();
1514 setSyncEventsReadOnly(); 1514 setSyncEventsReadOnly();
1515 updateUnmanagedViews(); 1515 updateUnmanagedViews();
1516 updateView(); 1516 updateView();
1517 if ( filename != MainWindow::defaultFileName() ) 1517 if ( filename != MainWindow::defaultFileName() )
1518 saveCalendar( MainWindow::defaultFileName() ); 1518 saveCalendar( MainWindow::defaultFileName() );
1519 loadedFileVersion = QDateTime::currentDateTime(); 1519 loadedFileVersion = QDateTime::currentDateTime();
1520 return true; 1520 return true;
1521 } else { 1521 } else {
1522 // while failing to load, the calendar object could 1522 // while failing to load, the calendar object could
1523 // have become partially populated. Clear it out. 1523 // have become partially populated. Clear it out.
1524 if ( !merge ) mCalendar->close(); 1524 if ( !merge ) mCalendar->close();
1525 1525
1526 KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename)); 1526 KMessageBox::error(this,i18n("Couldn't load calendar\n '%1'.").arg(filename));
1527 1527
1528 globalFlagBlockAgenda = 2; 1528 globalFlagBlockAgenda = 2;
1529 updateView(); 1529 updateView();
1530 } 1530 }
1531 return false; 1531 return false;
1532} 1532}
1533void CalendarView::setLoadedFileVersion(QDateTime dt) 1533void CalendarView::setLoadedFileVersion(QDateTime dt)
1534{ 1534{
1535 loadedFileVersion = dt; 1535 loadedFileVersion = dt;
1536} 1536}
1537bool CalendarView::checkFileChanged(QString fn) 1537bool CalendarView::checkFileChanged(QString fn)
1538{ 1538{
1539 QFileInfo finf ( fn ); 1539 QFileInfo finf ( fn );
1540 if ( !finf.exists() ) 1540 if ( !finf.exists() )
1541 return true; 1541 return true;
1542 QDateTime dt = finf.lastModified (); 1542 QDateTime dt = finf.lastModified ();
1543 if ( dt <= loadedFileVersion ) 1543 if ( dt <= loadedFileVersion )
1544 return false; 1544 return false;
1545 return true; 1545 return true;
1546 1546
1547} 1547}
1548void CalendarView::watchSavedFile()
1549{
1550 QFileInfo finf ( MainWindow::defaultFileName());
1551 if ( !finf.exists() )
1552 return;
1553 QDateTime dt = finf.lastModified ();
1554 if ( dt < loadedFileVersion ) {
1555 QTimer::singleShot( 1000 , this, SLOT ( watchSavedFile() ) );
1556 return;
1557 }
1558 loadedFileVersion = dt;
1559}
1560
1548bool CalendarView::checkFileVersion(QString fn) 1561bool CalendarView::checkFileVersion(QString fn)
1549{ 1562{
1550 QFileInfo finf ( fn ); 1563 QFileInfo finf ( fn );
1551 if ( !finf.exists() ) 1564 if ( !finf.exists() )
1552 return true; 1565 return true;
1553 QDateTime dt = finf.lastModified (); 1566 QDateTime dt = finf.lastModified ();
1554 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1()); 1567 //qDebug("loaded file version %s",loadedFileVersion.toString().latin1());
1555 //qDebug("file on disk version %s",dt.toString().latin1()); 1568 //qDebug("file on disk version %s",dt.toString().latin1());
1556 if ( dt <= loadedFileVersion ) 1569 if ( dt <= loadedFileVersion )
1557 return true; 1570 return true;
1558 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, false)) , 1571 int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file on disk has changed!\nFile size: %1 bytes.\nLast modified: %2\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) ,
1559 i18n("KO/Pi Warning"),i18n("Overwrite"), 1572 i18n("KO/Pi Warning"),i18n("Overwrite"),
1560 i18n("Sync+save")); 1573 i18n("Sync+save"));
1561 1574
1562 if ( km == KMessageBox::Cancel ) 1575 if ( km == KMessageBox::Cancel )
1563 return false; 1576 return false;
1564 if ( km == KMessageBox::Yes ) 1577 if ( km == KMessageBox::Yes )
1565 return true; 1578 return true;
1566 1579
1567 setSyncDevice("deleteaftersync" ); 1580 setSyncDevice("deleteaftersync" );
1568 KOPrefs::instance()->mAskForPreferences = true; 1581 KOPrefs::instance()->mAskForPreferences = true;
1569 KOPrefs::instance()->mSyncAlgoPrefs = 3; 1582 KOPrefs::instance()->mSyncAlgoPrefs = 3;
1570 KOPrefs::instance()->mWriteBackFile = false; 1583 KOPrefs::instance()->mWriteBackFile = false;
1571 KOPrefs::instance()->mWriteBackExistingOnly = false; 1584 KOPrefs::instance()->mWriteBackExistingOnly = false;
1572 KOPrefs::instance()->mShowSyncSummary = false; 1585 KOPrefs::instance()->mShowSyncSummary = false;
1573 syncCalendar( fn, 3 ); 1586 syncCalendar( fn, 3 );
1574 Event * e = getLastSyncEvent(); 1587 Event * e = getLastSyncEvent();
1575 mCalendar->deleteEvent ( e ); 1588 mCalendar->deleteEvent ( e );
1576 updateView(); 1589 updateView();
1577 return true; 1590 return true;
1578} 1591}
1579 1592
1580bool CalendarView::saveCalendar( QString filename ) 1593bool CalendarView::saveCalendar( QString filename )
1581{ 1594{
1582 1595
1583 // Store back all unsaved data into calendar object 1596 // Store back all unsaved data into calendar object
1584 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() ); 1597 // qDebug("file %s %d ", filename.latin1() , mViewManager->currentView() );
1585 if ( mViewManager->currentView() ) 1598 if ( mViewManager->currentView() )
1586 mViewManager->currentView()->flushView(); 1599 mViewManager->currentView()->flushView();
1587 1600
1588 //mStorage->setFileName( filename ); 1601 //mStorage->setFileName( filename );
1589 1602
1590 mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 1603 mStorage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
1591 mStorage->setFileName( filename ); 1604 mStorage->setFileName( filename );
1592 bool success; 1605 bool success;
1593 success = mStorage->save(); 1606 success = mStorage->save();
1594 if ( !success ) { 1607 if ( !success ) {
1595 return false; 1608 return false;
1596 } 1609 }
1597 1610
1598 return true; 1611 return true;
1599} 1612}
1600 1613
1601void CalendarView::closeCalendar() 1614void CalendarView::closeCalendar()
1602{ 1615{
1603 1616
1604 // child windows no longer valid 1617 // child windows no longer valid
1605 emit closingDown(); 1618 emit closingDown();
1606 1619
diff --git a/korganizer/calendarview.h b/korganizer/calendarview.h
index a3315ad..355bb84 100644
--- a/korganizer/calendarview.h
+++ b/korganizer/calendarview.h
@@ -127,96 +127,97 @@ class CalendarView : public KOrg::CalendarViewBase, public KCal::Calendar::Obser
127 child windows can also close. */ 127 child windows can also close. */
128 void closingDown(); 128 void closingDown();
129 /** emitted right before we die */ 129 /** emitted right before we die */
130 void closed(QWidget *); 130 void closed(QWidget *);
131 131
132 /** Emitted when state of modified flag changes */ 132 /** Emitted when state of modified flag changes */
133 void modifiedChanged(bool); 133 void modifiedChanged(bool);
134 void signalmodified(); 134 void signalmodified();
135 135
136 /** Emitted when state of read-only flag changes */ 136 /** Emitted when state of read-only flag changes */
137 void readOnlyChanged(bool); 137 void readOnlyChanged(bool);
138 138
139 /** Emitted when the unit of navigation changes */ 139 /** Emitted when the unit of navigation changes */
140 void changeNavStringPrev(const QString &); 140 void changeNavStringPrev(const QString &);
141 void changeNavStringNext(const QString &); 141 void changeNavStringNext(const QString &);
142 142
143 /** Emitted when state of events selection has changed and user is organizer*/ 143 /** Emitted when state of events selection has changed and user is organizer*/
144 void organizerEventsSelected(bool); 144 void organizerEventsSelected(bool);
145 /** Emitted when state of events selection has changed and user is attendee*/ 145 /** Emitted when state of events selection has changed and user is attendee*/
146 void groupEventsSelected(bool); 146 void groupEventsSelected(bool);
147 /** 147 /**
148 Emitted when an incidence gets selected. If the selection is cleared the 148 Emitted when an incidence gets selected. If the selection is cleared the
149 signal is emitted with 0 as argument. 149 signal is emitted with 0 as argument.
150 */ 150 */
151 void incidenceSelected( Incidence * ); 151 void incidenceSelected( Incidence * );
152 /** Emitted, when a todoitem is selected or deselected. */ 152 /** Emitted, when a todoitem is selected or deselected. */
153 void todoSelected( bool ); 153 void todoSelected( bool );
154 154
155 /** 155 /**
156 Emitted, when clipboard content changes. Parameter indicates if paste 156 Emitted, when clipboard content changes. Parameter indicates if paste
157 is possible or not. 157 is possible or not.
158 */ 158 */
159 void pasteEnabled(bool); 159 void pasteEnabled(bool);
160 160
161 /** Emitted, when the number of incoming messages has changed. */ 161 /** Emitted, when the number of incoming messages has changed. */
162 void numIncomingChanged(int); 162 void numIncomingChanged(int);
163 163
164 /** Emitted, when the number of outgoing messages has changed. */ 164 /** Emitted, when the number of outgoing messages has changed. */
165 void numOutgoingChanged(int); 165 void numOutgoingChanged(int);
166 166
167 /** Send status message, which can e.g. be displayed in the status bar. */ 167 /** Send status message, which can e.g. be displayed in the status bar. */
168 void statusMessage(const QString &); 168 void statusMessage(const QString &);
169 169
170 void calendarViewExpanded( bool ); 170 void calendarViewExpanded( bool );
171 void updateSearchDialog(); 171 void updateSearchDialog();
172 172
173 173
174 public slots: 174 public slots:
175 void watchSavedFile();
175 void recheckTimerAlarm(); 176 void recheckTimerAlarm();
176 void checkNextTimerAlarm(); 177 void checkNextTimerAlarm();
177 void addAlarm(const QDateTime &qdt, const QString &noti ); 178 void addAlarm(const QDateTime &qdt, const QString &noti );
178 void addSuspendAlarm(const QDateTime &qdt, const QString &noti ); 179 void addSuspendAlarm(const QDateTime &qdt, const QString &noti );
179 void removeAlarm(const QDateTime &qdt, const QString &noti ); 180 void removeAlarm(const QDateTime &qdt, const QString &noti );
180 181
181 /** options dialog made a changed to the configuration. we catch this 182 /** options dialog made a changed to the configuration. we catch this
182 * and notify all widgets which need to update their configuration. */ 183 * and notify all widgets which need to update their configuration. */
183 void updateConfig(); 184 void updateConfig();
184 185
185 /** 186 /**
186 Load calendar from file \a filename. If \a merge is true, load 187 Load calendar from file \a filename. If \a merge is true, load
187 calendar into existing one, if it is false, clear calendar, before 188 calendar into existing one, if it is false, clear calendar, before
188 loading. Return true, if calendar could be successfully loaded. 189 loading. Return true, if calendar could be successfully loaded.
189 */ 190 */
190 bool openCalendar(QString filename, bool merge=false); 191 bool openCalendar(QString filename, bool merge=false);
191 bool syncCalendar(QString filename,int mode = 0 ); 192 bool syncCalendar(QString filename,int mode = 0 );
192 193
193 /** 194 /**
194 Save calendar data to file. Return true if calendar could be 195 Save calendar data to file. Return true if calendar could be
195 successfully saved. 196 successfully saved.
196 */ 197 */
197 bool saveCalendar(QString filename); 198 bool saveCalendar(QString filename);
198 199
199 /** 200 /**
200 Close calendar. Clear calendar data and reset views to display an empty 201 Close calendar. Clear calendar data and reset views to display an empty
201 calendar. 202 calendar.
202 */ 203 */
203 void closeCalendar(); 204 void closeCalendar();
204 205
205 /** Archive old events of calendar */ 206 /** Archive old events of calendar */
206 void archiveCalendar(); 207 void archiveCalendar();
207 208
208 void showIncidence(); 209 void showIncidence();
209 void editIncidence(); 210 void editIncidence();
210 void editIncidenceDescription(); 211 void editIncidenceDescription();
211 void deleteIncidence(); 212 void deleteIncidence();
212 213
213 /** create an editeventwin with supplied date/time, and if bool is true, 214 /** create an editeventwin with supplied date/time, and if bool is true,
214 * make the event take all day. */ 215 * make the event take all day. */
215 void newEvent(QDateTime, QDateTime, bool allDay = false); 216 void newEvent(QDateTime, QDateTime, bool allDay = false);
216 void newEvent(QDateTime fh); 217 void newEvent(QDateTime fh);
217 void newEvent(QDate dt); 218 void newEvent(QDate dt);
218 /** create new event without having a date hint. Takes current date as 219 /** create new event without having a date hint. Takes current date as
219 default hint. */ 220 default hint. */
220 void newEvent(); 221 void newEvent();
221 void newFloatingEvent(); 222 void newFloatingEvent();
222 223
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 1c4a186..6315c64 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1363,100 +1363,101 @@ void MainWindow::importQtopia()
1363 mView->importQtopia( categories, datebook, todolist ); 1363 mView->importQtopia( categories, datebook, todolist );
1364 } 1364 }
1365#else 1365#else
1366 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1366 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1367 i18n("Not supported \non desktop!\n"), 1367 i18n("Not supported \non desktop!\n"),
1368 i18n("Ok"), i18n("Cancel"), 0, 1368 i18n("Ok"), i18n("Cancel"), 0,
1369 0, 1 ); 1369 0, 1 );
1370 1370
1371#endif 1371#endif
1372} 1372}
1373 1373
1374void MainWindow::saveOnClose() 1374void MainWindow::saveOnClose()
1375{ 1375{
1376 KOPrefs *p = KOPrefs::instance(); 1376 KOPrefs *p = KOPrefs::instance();
1377 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal ); 1377 p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
1378 p->mToolBarUp = iconToolBar->x() > width()/2 || 1378 p->mToolBarUp = iconToolBar->x() > width()/2 ||
1379 iconToolBar->y() > height()/2; 1379 iconToolBar->y() > height()/2;
1380 mView->writeSettings(); 1380 mView->writeSettings();
1381 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName())) 1381 if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
1382 save(); 1382 save();
1383} 1383}
1384void MainWindow::slotModifiedChanged( bool changed ) 1384void MainWindow::slotModifiedChanged( bool changed )
1385{ 1385{
1386 if ( mBlockAtStartup ) 1386 if ( mBlockAtStartup )
1387 return; 1387 return;
1388 int msec; 1388 int msec;
1389 // we store the changes after 1 minute, 1389 // we store the changes after 1 minute,
1390 // and for safety reasons after 10 minutes again 1390 // and for safety reasons after 10 minutes again
1391 if ( !mBlockSaveFlag ) 1391 if ( !mBlockSaveFlag )
1392 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000; 1392 msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
1393 else 1393 else
1394 msec = 1000 * 600; 1394 msec = 1000 * 600;
1395 mSaveTimer.start( msec, true ); // 1 minute 1395 mSaveTimer.start( msec, true ); // 1 minute
1396 qDebug("KO: Saving File in %d secs!", msec/1000); 1396 qDebug("KO: Saving File in %d secs!", msec/1000);
1397 mCalendarModifiedFlag = true; 1397 mCalendarModifiedFlag = true;
1398} 1398}
1399#include <qfileinfo.h> 1399#include <qfileinfo.h>
1400void MainWindow::save() 1400void MainWindow::save()
1401{ 1401{
1402 if ( mBlockSaveFlag ) 1402 if ( mBlockSaveFlag )
1403 return; 1403 return;
1404 bool store = mBlockSaveFlag; 1404 bool store = mBlockSaveFlag;
1405 mBlockSaveFlag = true; 1405 mBlockSaveFlag = true;
1406 if ( mView->checkFileVersion( defaultFileName()) ) { 1406 if ( mView->checkFileVersion( defaultFileName()) ) {
1407 1407
1408 QTime neededSaveTime = QDateTime::currentDateTime().time(); 1408 QTime neededSaveTime = QDateTime::currentDateTime().time();
1409 setCaption(i18n("KO/Pi:Saving Data to File ..." )); 1409 setCaption(i18n("KO/Pi:Saving Data to File ..." ));
1410 qDebug("KO: Start saving data to file!"); 1410 qDebug("KO: Start saving data to file!");
1411 mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1));
1411 mView->saveCalendar( defaultFileName() ); 1412 mView->saveCalendar( defaultFileName() );
1412 1413
1413 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() ); 1414 int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
1414 mView->setLoadedFileVersion(QDateTime::currentDateTime()); 1415 mView->watchSavedFile();
1415 qDebug("KO: Needed %d ms for saving.",msNeeded ); 1416 qDebug("KO: Needed %d ms for saving.",msNeeded );
1416 QString savemes; 1417 QString savemes;
1417 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 ); 1418 savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
1418 setCaption(savemes); 1419 setCaption(savemes);
1419 } else 1420 } else
1420 setCaption(i18n("Saving cancelled!")); 1421 setCaption(i18n("Saving cancelled!"));
1421 mCalendarModifiedFlag = false; 1422 mCalendarModifiedFlag = false;
1422 mBlockSaveFlag = store; 1423 mBlockSaveFlag = store;
1423} 1424}
1424 1425
1425void MainWindow::keyReleaseEvent ( QKeyEvent * e) 1426void MainWindow::keyReleaseEvent ( QKeyEvent * e)
1426{ 1427{
1427 if ( !e->isAutoRepeat() ) { 1428 if ( !e->isAutoRepeat() ) {
1428 mFlagKeyPressed = false; 1429 mFlagKeyPressed = false;
1429 } 1430 }
1430} 1431}
1431void MainWindow::keyPressEvent ( QKeyEvent * e ) 1432void MainWindow::keyPressEvent ( QKeyEvent * e )
1432{ 1433{
1433 qApp->processEvents(); 1434 qApp->processEvents();
1434 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 1435 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1435 e->ignore(); 1436 e->ignore();
1436 // qDebug(" ignore %d",e->isAutoRepeat() ); 1437 // qDebug(" ignore %d",e->isAutoRepeat() );
1437 return; 1438 return;
1438 } 1439 }
1439 if (! e->isAutoRepeat() ) 1440 if (! e->isAutoRepeat() )
1440 mFlagKeyPressed = true; 1441 mFlagKeyPressed = true;
1441 KOPrefs *p = KOPrefs::instance(); 1442 KOPrefs *p = KOPrefs::instance();
1442 bool showSelectedDates = false; 1443 bool showSelectedDates = false;
1443 int size; 1444 int size;
1444 int pro = 0; 1445 int pro = 0;
1445 //qDebug("MainWindow::keyPressEvent "); 1446 //qDebug("MainWindow::keyPressEvent ");
1446 switch ( e->key() ) { 1447 switch ( e->key() ) {
1447 case Qt::Key_Right: 1448 case Qt::Key_Right:
1448 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton) 1449 if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
1449 mView->goNextMonth(); 1450 mView->goNextMonth();
1450 else 1451 else
1451 mView->goNext(); 1452 mView->goNext();
1452 showSelectedDates = true; 1453 showSelectedDates = true;
1453 break; 1454 break;
1454 case Qt::Key_Left: 1455 case Qt::Key_Left:
1455 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton ) 1456 if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
1456 mView->goPreviousMonth(); 1457 mView->goPreviousMonth();
1457 else 1458 else
1458 mView->goPrevious(); 1459 mView->goPrevious();
1459 showSelectedDates = true; 1460 showSelectedDates = true;
1460 break; 1461 break;
1461 case Qt::Key_Down: 1462 case Qt::Key_Down:
1462 mView->viewManager()->agendaView()->scrollOneHourDown(); 1463 mView->viewManager()->agendaView()->scrollOneHourDown();