summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp39
1 files changed, 30 insertions, 9 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 8f5de4d..753d81f 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -621,55 +621,58 @@ void CalendarView::init()
connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)),
this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
#endif
mDateNavigator->setCalendar( mCalendar );
}
CalendarView::~CalendarView()
{
// kdDebug() << "~CalendarView()" << endl;
//qDebug("CalendarView::~CalendarView() ");
delete mDialogManager;
delete mViewManager;
delete mStorage;
delete mDateFrame ;
delete beamDialog;
delete mEventViewerDialog;
//kdDebug() << "~CalendarView() done" << endl;
}
void CalendarView::checkAlarms()
{
KConfig *config = KOGlobals::config();
config->setGroup( "AppRun" );
QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
+ int daysto = dt.daysTo( QDate::currentDate() );
+ int days = config->readNumEntry( "LatestProgramStopDays" , daysto);
+ dt = dt.addDays( days );
int secto = dt.secsTo( QDateTime::currentDateTime() );
- int secs = config->readNumEntry( "LatestProgramStop" , secto) - 30;
- qDebug("KO: Reading program stop %d ", secs);
+ int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30;
+ //qDebug("KO: Reading program stop %d ", secs);
//secs -= ( 3600 * 24*3 ); // debug only
QDateTime latest = dt.addSecs ( secs );
qDebug("KO: Last termination on %s ", latest.toString().latin1());
- qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
+ //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
QPtrList<Incidence> el = mCalendar->rawIncidences();
QPtrList<Incidence> al;
Incidence* inL = el.first();
QDateTime cur = QDateTime::currentDateTime().addSecs(-59);
qDebug("KO: Checking alarm until %s ", cur.toString().latin1());
while ( inL ) {
bool ok = false;
int offset = 0;
QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ;
if ( ok ) {
//qDebug("OK %s",next.toString().latin1());
if ( next < cur ) {
al.append( inL );
//qDebug("found missed alarm: %s ", inL->summary().latin1() );
}
}
inL = el.next();
}
if ( al.count() ) {
QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop );
dia->setCaption( i18n("KO/Pi: Missing alarms!") );
QVBoxLayout* lay = new QVBoxLayout( dia );
lay->setSpacing( 0 );
lay->setMargin( 0 );
@@ -2137,58 +2140,76 @@ void CalendarView::readSettings()
else if ( dateCount == 7 ) mNavigator->selectWeek();
else mNavigator->selectDates( dateCount );
// mViewManager->readSettings( config );
updateConfig();
globalFlagBlockAgenda = 2;
mViewManager->readSettings( config );
QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) );
}
void CalendarView::writeSettings()
{
// kdDebug() << "CalendarView::writeSettings" << endl;
KConfig *config = KOGlobals::config();
mViewManager->writeSettings( config );
mTodoList->saveLayout(config,QString("Todo Layout"));
mDialogManager->writeSettings( config );
//KOPrefs::instance()->usrWriteConfig();
KOPrefs::instance()->writeConfig();
writeFilterSettings(config);
config->setGroup( "AppRun" );
- QDateTime dt ( QDate (2005,3,1), QTime( 0,0,0 ) );
+ QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) );
+ int days = dt.daysTo( QDate::currentDate() );
+ dt = dt.addDays( days );
int secs = dt.secsTo( QDateTime::currentDateTime() );
- config->writeEntry( "LatestProgramStop", secs );
- qDebug("KO: Writing stop time: %d ", secs);
- qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
- QDateTime latest = dt.addSecs ( secs );
- qDebug("KO: Test termination on %s ", latest.toString().latin1());
+ config->writeEntry( "LatestProgramStopDays", days );
+ config->writeEntry( "LatestProgramStopSecs", secs );
+ //qDebug("KO: Writing stop time: %d ", secs);
+ //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() );
+ //QDateTime latest = dt.addSecs ( secs );
+ //qDebug("KO: Termination on %s ", latest.toString().latin1());
config->setGroup( "Views" );
config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() );
+#if 0
+ qDebug("********************* ");
+ qDebug("Testcode secsto ");
+ QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) );
+ QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) );
+ int secsto = dt_nodaylight.secsTo( dt_daylight );
+ QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto );
+ qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() );
+ qDebug("dt daylight %s ",dt_daylight.toString().latin1() );
+ qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() );
+ qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600);
+ qDebug("********************* testcode end");
+
+#endif
+
QValueList<int> listINT = mLeftFrame->sizes();
config->writeEntry("Left Splitter Frame",listINT);
QValueList<int> listINT2 = mMainFrame->sizes();
config->writeEntry("Main Splitter Frame",listINT2);
#ifdef DESKTOP_VERSION
config->setGroup("WidgetLayout");
QStringList list ;//= config->readListEntry("MainLayout");
int x,y,w,h;
QWidget* wid;
wid = topLevelWidget();
x = wid->geometry().x();
y = wid->geometry().y();
w = wid->width();
h = wid->height();
list.clear();
list << QString::number( x );
list << QString::number( y );
list << QString::number( w );
list << QString::number( h );
config->writeEntry("MainLayout",list );
wid = mEventEditor;
x = wid->geometry().x();
y = wid->geometry().y();