summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp2
-rw-r--r--korganizer/kofilterview.h1
-rw-r--r--korganizer/komonthview.cpp8
-rw-r--r--korganizer/komonthview.h3
-rw-r--r--korganizer/mainwindow.cpp9
5 files changed, 16 insertions, 7 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 678143d..5c88abd 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2075,49 +2075,49 @@ bool CalendarView::checkAllFileVersions()
mCalendar->setDefaultCalendar( cal->mCalNumber );
mCalendar->setDefaultCalendarEnabledOnly();
loadedFileVersion = cal->mLoadDt.addSecs( 15 );
if ( !checkFileVersion(cal->mFileName )) {
loadedFileVersion = storeTemp;
restoreCalendarSettings();
return false;
}
}
cal = calendars.next();
}
loadedFileVersion = storeTemp;
return true;
}
bool CalendarView::checkFileVersion(QString fn)
{
QFileInfo finf ( fn );
if ( !finf.exists() )
return true;
QDateTime dt = finf.lastModified ();
qDebug("loaded file version %s %s", fn.latin1(), loadedFileVersion.toString().latin1());
qDebug("file on disk version %s %s", fn.latin1(),dt.toString().latin1());
if ( dt <= loadedFileVersion )
return true;
- int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\n on disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(fn).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) ,
+ int km = KMessageBox::warningYesNoCancel(this, i18n("\nThe file\n%1\non disk has changed!\nFile size: %2 bytes.\nLast modified: %3\nDo you want to:\n\n - Save and overwrite file?\n - Sync with file, then save?\n - Cancel without saving? \n").arg(KGlobal::formatMessage(fn,0)).arg( QString::number( finf.size())).arg( KGlobal::locale()->formatDateTime(finf.lastModified (), true, true)) ,
i18n("KO/Pi Warning"),i18n("Overwrite"),
i18n("Sync+save"));
if ( km == KMessageBox::Cancel )
return false;
if ( km == KMessageBox::Yes )
return true;
setSyncDevice("deleteaftersync" );
mSyncManager->mAskForPreferences = true;
mSyncManager->mSyncAlgoPrefs = 3;
mSyncManager->mWriteBackFile = false;
mSyncManager->mWriteBackExistingOnly = false;
mSyncManager->mShowSyncSummary = false;
syncCalendar( fn, 3 );
Event * e = getLastSyncEvent();
if ( e )
mCalendar->deleteEvent( e );
return true;
}
bool CalendarView::saveCalendars()
{
QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
KopiCalendarFile * cal = calendars.first();
diff --git a/korganizer/kofilterview.h b/korganizer/kofilterview.h
index 874fc6a..4322299 100644
--- a/korganizer/kofilterview.h
+++ b/korganizer/kofilterview.h
@@ -4,48 +4,49 @@
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As a special exception, permission is given to link this program
with any edition of Qt, and distribute the resulting executable,
without including the source code for Qt in the source distribution.
*/
#ifndef KOFILTERVIEW_H
#define KOFILTERVIEW_H
#include <qstring.h>
#include <qcheckbox.h>
+#include <qapplication.h>
#include <qradiobutton.h>
#include <qlayout.h>
#include <qlabel.h>
#include <qdialog.h>
#include <qscrollview.h>
#include <qpushbutton.h>
#include <kconfig.h>
#include "kofilterview_base.h"
#include <libkcal/calfilter.h>
#include <kurlrequester.h>
#include <klineedit.h>
#include <kglobal.h>
#include <kmessagebox.h>
class QGridLayout;
using namespace KCal;
class KONewCalPrefs : public QDialog
{
Q_OBJECT
public:
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 264cf28..4fc447e 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1771,73 +1771,75 @@ void KOMonthView::updateView()
(*cells)[i]->updateCell();
}
//qDebug("KOMonthView::updateView() ");
processSelectionChange();
// qDebug("---------------------------------------------------------------------+ ");
(*cells)[0]->setFocus();
#endif
//qDebug("update time %d ", ti.elapsed());
}
void KOMonthView::setKeyBoardFocus()
{
//qDebug("KOMonthView::setKeyBoardFocus() ");
bool shootAgain = false;
if ( mShowWeekView ) {
shootAgain = !mWeekLabelsW[1]->hasFocus();
mWeekLabelsW[1]->setFocus();
}
else {
shootAgain = !mWeekLabels[mNumWeeks]->hasFocus();
mWeekLabels[mNumWeeks]->setFocus();
}
- if ( shootAgain ) {
- QTimer::singleShot( 0, this, SLOT ( setKeyBFocus() ) );
+ --mKBFcounter;
+ if ( shootAgain && mKBFcounter > 0 ) {
+ QTimer::singleShot( 50, this, SLOT ( setKeyBoardFocus() ) );
}
}
void KOMonthView::setKeyBFocus()
{
//qDebug("KOMonthView::setKeyBFocus() ");
+ mKBFcounter = 10;
QTimer::singleShot( 0, this, SLOT ( setKeyBoardFocus() ) );
}
void KOMonthView::resizeEvent(QResizeEvent * e)
{
//qDebug("KOMonthView::resizeEvent %d %d -- %d %d ", e->size().width(), e->size().height(), e->oldSize().width(), e->oldSize().height());
if ( isVisible() ) {
//qDebug("KOMonthView::isVisible ");
slotComputeLayout();
} else
mComputeLayoutTimer->start( 100 );
}
void KOMonthView::slotComputeLayout()
{
mComputeLayoutTimer->stop();
//qDebug("KOMonthView::Post - resizeEvent %d %d ", width(), height() );
computeLayout();
- clPending = true;
+ clPending = true;
setKeyBFocus();
}
void KOMonthView::computeLayoutWeek()
{
static int lastWid = 0;
static int lastHei = 0;
int daysToShow;
bool combinedSatSun = false;
if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) {
daysToShow = 6;
combinedSatSun = true;
}
int tWid = topLevelWidget()->size().width();
int tHei = topLevelWidget()->size().height();
int wid = width();//e
int hei = height()-1-mNavigatorBar->height();
if ( ((wid *3)/2) < tWid && (( hei *3) /2) < tHei )
return;
if ( lastWid == width() && lastHei == height() ) {
//qDebug("KOListWeekView::No compute layout needed ");
return;
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index 0bd6b1c..a41eb54 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -257,72 +257,73 @@ class KOMonthView: public KOEventView
bool isUpdatePossible() { return updatePossible; }
MonthViewCell * selectedCell();
bool skipResize;
NavigatorBar* navigatorBar() { return mNavigatorBar ;}
void clearList();
public slots:
void incidenceHighlighted( Incidence *, MonthViewCell*, int );
void nextCell();
void prevCell();
virtual void updateView();
virtual void updateConfig();
virtual void showDates(const QDate &start, const QDate &end);
virtual void showEvents(QPtrList<Event> eventList);
void changeEventDisplay(Event *, int);
void clearSelection();
void showContextMenu( Incidence * );
void setSelectedCell( MonthViewCell * );
void setPopupCell( MonthViewCell * );
void switchView();
- void setKeyBoardFocus();
void setKeyBFocus();
protected slots:
+ void setKeyBoardFocus();
void slotNewTodo();
void slotNewEvent();
void slotEditJournal();
void slotComputeLayout();
void selectInternalWeekNum ( int );
void processSelectionChange();
signals:
void nextMonth();
void prevMonth();
void selectWeekNum ( int );
void selectMonth ();
void showDaySignal( QDate );
void newTodoSignal( QDateTime, bool );
void showJournalSignal( int,QDate );
protected:
void resizeEvent(QResizeEvent *);
void viewChanged();
void updateDayLabels();
private:
+ int mKBFcounter;
QTimer* mComputeLayoutTimer;
NavigatorBar* mNavigatorBar;
int currentWeek();
bool clPending;
QWidgetStack * mWidStack;
QWidget* mMonthView;
QWidget* mWeekView;
bool mShowWeekView;
bool updatePossible;
int mDaysPerWeek;
int mNumWeeks;
int mNumCells;
//bool mWeekStartsMonday;
bool mShowSatSunComp;
void computeLayout();
void computeLayoutWeek();
QPtrVector<MonthViewCell> mCells;
QPtrVector<QLabel> mDayLabels;
QPtrVector<KOWeekButton> mWeekLabels;
QPtrVector<MonthViewCell> mCellsW;
QPtrVector<QLabel> mDayLabelsW;
QPtrVector<KOWeekButton> mWeekLabelsW;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 862d437..f68f032 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1891,76 +1891,81 @@ void MainWindow::backupAllFiles()
} else if ( retval == 1 ){
qDebug("KO: Backup created.");
// backup ok
QPtrList<KopiCalendarFile> calendars = KOPrefs::instance()->mCalendars;
KopiCalendarFile * cal = calendars.first();
cal = calendars.next();
while ( cal ) {
if ( !cal->mErrorOnLoad ) {
KApplication::createBackup( cal->mFileName, bupDir, KPimGlobalPrefs::instance()->mBackupNumbers );
}
cal = calendars.next();
}
KOPrefs::instance()->mLastBackupDate = daysTo;
setCaption(i18n("Backup succesfully finished" ));
} else if ( retval == 2 ){
setCaption(i18n("Backup globally disabled" ));
qDebug("KO: Backup globally cancelled.");
// backup globally cancelled
KPimGlobalPrefs::instance()->mBackupEnabled = false;
}
// retval == 3: do nothing, try again later
}
void MainWindow::save()
{
+
if ( mView->viewManager()->journalView() )
mView->viewManager()->journalView()->checkModified();
if ( !mCalendarModifiedFlag ) {
qDebug("KO: Calendar not modified. Nothing saved.");
return;
}
if ( mSyncManager->blockSave() )
return;
mSyncManager->setBlockSave(true);
if ( mView->checkAllFileVersions() ) {
if ( KPimGlobalPrefs::instance()->mBackupEnabled ){
QDate reference ( 2000,1,1);
int daysTo = reference.daysTo ( QDate::currentDate() );
if ( daysTo - KPimGlobalPrefs::instance()->mBackupDayCount >= KOPrefs::instance()->mLastBackupDate ) {
backupAllFiles();
}
; // KPimGlobalPrefs::instance()->mLastBackupDate
}
QTime neededSaveTime = QDateTime::currentDateTime().time();
- setCaption(i18n("KO/Pi:Saving Data to File ..." ));
+ if ( !isMinimized () )
+ setCaption(i18n("KO/Pi:Saving Data to File ..." ));
qDebug("KO: Start saving data to file!");
mView->saveCalendars();
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);
+ if ( !isMinimized () )
+ setCaption(savemes);
+ else
+ qDebug(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;