summaryrefslogtreecommitdiffabout
path: root/korganizer/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp4
1 files changed, 0 insertions, 4 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 9505d06..94f4677 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1681,196 +1681,192 @@ void MainWindow::importQtopia()
#else
QString datebook = QDir::homeDirPath()+ "/Applications/datebook/datebook.xml";
QString todolist = QDir::homeDirPath()+ "/Applications/todolist/todolist.xml";
QString categories = QDir::homeDirPath()+ "/Settings/Categories.xml";
#endif
mView->importQtopia( categories, datebook, todolist );
}
#if 0
int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
i18n("Not supported \non desktop!\n"),
i18n("Ok"), i18n("Cancel"), 0,
0, 1 );
#endif
}
void MainWindow::saveOnClose()
{
KOPrefs *p = KOPrefs::instance();
p->mToolBarHor = ( iconToolBar->orientation () == Qt:: Horizontal );
p->mToolBarHorV = ( viewToolBar->orientation () == Qt:: Horizontal );
p->mToolBarHorN = ( navigatorToolBar->orientation () == Qt:: Horizontal );
if ( filterToolBar ) {
p->mToolBarHorF = ( filterToolBar->orientation () == Qt:: Horizontal );
}
#ifdef DESKTOP_VERSION
QPoint myP;
myP = mapFromGlobal( iconToolBar->mapToGlobal( QPoint( 0,0) ) );
if ( p->mToolBarHor )
p->mToolBarUp = myP.y() > height()/2;
else
p->mToolBarUp = myP.x() > width()/2;
myP = mapFromGlobal( viewToolBar->mapToGlobal( QPoint( 0,0) ) );
if ( p->mToolBarHorV )
p->mToolBarUpV = myP.y() > height()/2;
else
p->mToolBarUpV = myP.x() > width()/2 ;
myP = mapFromGlobal( navigatorToolBar->mapToGlobal( QPoint( 0,0) ) );
if ( p->mToolBarHorN )
p->mToolBarUpN = myP.y() > height()/2;
else
p->mToolBarUpN = myP.x() > width()/2 ;
if ( filterToolBar ) {
myP = mapFromGlobal( filterToolBar->mapToGlobal( QPoint( 0,0) ) );
if ( p->mToolBarHorF )
p->mToolBarUpF = myP.y() > height()/2;
else
p->mToolBarUpF = myP.x() > width()/2 ;
}
#else
if ( p->mToolBarHor )
p->mToolBarUp = iconToolBar->y() > height()/2;
else
p->mToolBarUp = iconToolBar->x() > width()/2;
if ( p->mToolBarHorV )
p->mToolBarUpV = viewToolBar->y() > height()/2;
else
p->mToolBarUpV = viewToolBar->x() > width()/2 ;
if ( p->mToolBarHorN )
p->mToolBarUpN = navigatorToolBar->y() > height()/2;
else
p->mToolBarUpN = navigatorToolBar->x() > width()/2 ;
if ( filterToolBar ) {
if ( p->mToolBarHorF )
p->mToolBarUpF = filterToolBar->y() > height()/2;
else
p->mToolBarUpF = filterToolBar->x() > width()/2 ;
}
#endif
mView->writeSettings();
if ( mCalendarModifiedFlag || mView->checkFileChanged( defaultFileName()))
save();
}
void MainWindow::slotModifiedChanged( bool changed )
{
if ( mBlockAtStartup )
return;
int msec;
// we store the changes after 1 minute,
// and for safety reasons after 10 minutes again
if ( !mSyncManager->blockSave() )
msec = (1000 * 60*KOPrefs::instance()->mAutoSaveInterval) +1000;
else
msec = 1000 * 600;
mSaveTimer.start( msec, true ); // 1 minute
qDebug("KO: Saving File in %d secs!", msec/1000);
mCalendarModifiedFlag = true;
}
void MainWindow::saveStopTimer()
{
mSaveTimer.stop();
- if (mSaveTimer.isActive() )
- qDebug("ti active ");
- else
- qDebug("KO: Save timer stopped");
}
void MainWindow::save()
{
if ( !mCalendarModifiedFlag ) {
qDebug("KO: Calendar not modified. Nothing saved.");
return;
}
if ( mSyncManager->blockSave() )
return;
mSyncManager->setBlockSave(true);
if ( mView->checkFileVersion( defaultFileName()) ) {
QTime neededSaveTime = QDateTime::currentDateTime().time();
setCaption(i18n("KO/Pi:Saving Data to File ..." ));
qDebug("KO: Start saving data to file!");
mView->saveCalendar( defaultFileName() );
mCalendarModifiedFlag = false;
int msNeeded = neededSaveTime.msecsTo( QDateTime::currentDateTime().time() );
qDebug("KO: Needed %d ms for saving.",msNeeded );
QString savemes;
savemes.sprintf(i18n("KO/Pi:File Saved. Needed %d sec, %d ms"),(msNeeded/1000)%100,msNeeded%1000 );
setCaption(savemes);
} else
setCaption(i18n("Saving cancelled!"));
mSyncManager->setBlockSave( false );
}
void MainWindow::keyReleaseEvent ( QKeyEvent * e)
{
if ( !e->isAutoRepeat() ) {
mFlagKeyPressed = false;
}
}
void MainWindow::keyPressEvent ( QKeyEvent * e )
{
qApp->processEvents();
if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
e->ignore();
// qDebug(" ignore %d",e->isAutoRepeat() );
return;
}
if (! e->isAutoRepeat() )
mFlagKeyPressed = true;
KOPrefs *p = KOPrefs::instance();
bool showSelectedDates = false;
int size;
int pro = 0;
//qDebug("MainWindow::keyPressEvent ");
switch ( e->key() ) {
case Qt::Key_Right:
if ( e->state() == Qt::ControlButton || e->state() == Qt::ShiftButton)
mView->goNextMonth();
else
mView->goNext();
showSelectedDates = true;
break;
case Qt::Key_Left:
if ( e->state() == Qt::ControlButton|| e->state() == Qt::ShiftButton )
mView->goPreviousMonth();
else
mView->goPrevious();
showSelectedDates = true;
break;
case Qt::Key_Down:
mView->viewManager()->agendaView()->scrollOneHourDown();
break;
case Qt::Key_Up:
mView->viewManager()->agendaView()->scrollOneHourUp();
break;
case Qt::Key_K:
mView->viewManager()->showMonthViewWeek();
break;
case Qt::Key_I:
mView->showIncidence();
break;
case Qt::Key_Delete:
case Qt::Key_Backspace:
mView->deleteIncidence();
break;
case Qt::Key_D:
mView->viewManager()->showDayView();
showSelectedDates = true;
break;
case Qt::Key_O:
mView->toggleFilerEnabled( );
break;
case Qt::Key_0:
case Qt::Key_1:
case Qt::Key_2:
case Qt::Key_3:
case Qt::Key_4:
case Qt::Key_5:
case Qt::Key_6:
case Qt::Key_7:
case Qt::Key_8:
case Qt::Key_9:
pro = e->key()-48;