-rw-r--r-- | korganizer/calendarview.cpp | 39 | ||||
-rw-r--r-- | microkde/kfiledialog.cpp | 2 |
2 files changed, 31 insertions, 10 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index 8f5de4d..753d81f 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -613,71 +613,74 @@ void CalendarView::init() | |||
613 | mAlarmDialog = new AlarmDialog( this ); | 613 | mAlarmDialog = new AlarmDialog( this ); |
614 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); | 614 | connect( mAlarmDialog, SIGNAL( addAlarm(const QDateTime &, const QString & ) ), SLOT( addSuspendAlarm(const QDateTime &, const QString & ) ) ); |
615 | mAlarmDialog->setServerNotification( false ); | 615 | mAlarmDialog->setServerNotification( false ); |
616 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); | 616 | mAlarmDialog->setSuspendTime( KOPrefs::instance()->mAlarmSuspendTime ); |
617 | 617 | ||
618 | 618 | ||
619 | #ifndef DESKTOP_VERSION | 619 | #ifndef DESKTOP_VERSION |
620 | //US listen for arriving address resultsets | 620 | //US listen for arriving address resultsets |
621 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), | 621 | connect(ExternalAppHandler::instance(), SIGNAL(receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), |
622 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 622 | this, SLOT(insertBirthdays(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
623 | #endif | 623 | #endif |
624 | mDateNavigator->setCalendar( mCalendar ); | 624 | mDateNavigator->setCalendar( mCalendar ); |
625 | } | 625 | } |
626 | 626 | ||
627 | 627 | ||
628 | CalendarView::~CalendarView() | 628 | CalendarView::~CalendarView() |
629 | { | 629 | { |
630 | // kdDebug() << "~CalendarView()" << endl; | 630 | // kdDebug() << "~CalendarView()" << endl; |
631 | //qDebug("CalendarView::~CalendarView() "); | 631 | //qDebug("CalendarView::~CalendarView() "); |
632 | delete mDialogManager; | 632 | delete mDialogManager; |
633 | delete mViewManager; | 633 | delete mViewManager; |
634 | delete mStorage; | 634 | delete mStorage; |
635 | delete mDateFrame ; | 635 | delete mDateFrame ; |
636 | delete beamDialog; | 636 | delete beamDialog; |
637 | delete mEventViewerDialog; | 637 | delete mEventViewerDialog; |
638 | //kdDebug() << "~CalendarView() done" << endl; | 638 | //kdDebug() << "~CalendarView() done" << endl; |
639 | } | 639 | } |
640 | void CalendarView::checkAlarms() | 640 | void CalendarView::checkAlarms() |
641 | { | 641 | { |
642 | KConfig *config = KOGlobals::config(); | 642 | KConfig *config = KOGlobals::config(); |
643 | config->setGroup( "AppRun" ); | 643 | config->setGroup( "AppRun" ); |
644 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); | 644 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
645 | int daysto = dt.daysTo( QDate::currentDate() ); | ||
646 | int days = config->readNumEntry( "LatestProgramStopDays" , daysto); | ||
647 | dt = dt.addDays( days ); | ||
645 | int secto = dt.secsTo( QDateTime::currentDateTime() ); | 648 | int secto = dt.secsTo( QDateTime::currentDateTime() ); |
646 | int secs = config->readNumEntry( "LatestProgramStop" , secto) - 30; | 649 | int secs = config->readNumEntry( "LatestProgramStopSecs" , secto) - 30; |
647 | qDebug("KO: Reading program stop %d ", secs); | 650 | //qDebug("KO: Reading program stop %d ", secs); |
648 | //secs -= ( 3600 * 24*3 ); // debug only | 651 | //secs -= ( 3600 * 24*3 ); // debug only |
649 | QDateTime latest = dt.addSecs ( secs ); | 652 | QDateTime latest = dt.addSecs ( secs ); |
650 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); | 653 | qDebug("KO: Last termination on %s ", latest.toString().latin1()); |
651 | qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 654 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
652 | QPtrList<Incidence> el = mCalendar->rawIncidences(); | 655 | QPtrList<Incidence> el = mCalendar->rawIncidences(); |
653 | QPtrList<Incidence> al; | 656 | QPtrList<Incidence> al; |
654 | Incidence* inL = el.first(); | 657 | Incidence* inL = el.first(); |
655 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); | 658 | QDateTime cur = QDateTime::currentDateTime().addSecs(-59); |
656 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); | 659 | qDebug("KO: Checking alarm until %s ", cur.toString().latin1()); |
657 | while ( inL ) { | 660 | while ( inL ) { |
658 | bool ok = false; | 661 | bool ok = false; |
659 | int offset = 0; | 662 | int offset = 0; |
660 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; | 663 | QDateTime next = inL->getNextAlarmDateTime(& ok, &offset, latest ) ; |
661 | if ( ok ) { | 664 | if ( ok ) { |
662 | //qDebug("OK %s",next.toString().latin1()); | 665 | //qDebug("OK %s",next.toString().latin1()); |
663 | if ( next < cur ) { | 666 | if ( next < cur ) { |
664 | al.append( inL ); | 667 | al.append( inL ); |
665 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); | 668 | //qDebug("found missed alarm: %s ", inL->summary().latin1() ); |
666 | } | 669 | } |
667 | } | 670 | } |
668 | inL = el.next(); | 671 | inL = el.next(); |
669 | } | 672 | } |
670 | if ( al.count() ) { | 673 | if ( al.count() ) { |
671 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); | 674 | QDialog* dia = new QDialog( this, "huhu", false, WDestructiveClose | WStyle_StaysOnTop ); |
672 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); | 675 | dia->setCaption( i18n("KO/Pi: Missing alarms!") ); |
673 | QVBoxLayout* lay = new QVBoxLayout( dia ); | 676 | QVBoxLayout* lay = new QVBoxLayout( dia ); |
674 | lay->setSpacing( 0 ); | 677 | lay->setSpacing( 0 ); |
675 | lay->setMargin( 0 ); | 678 | lay->setMargin( 0 ); |
676 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); | 679 | MissedAlarmTextBrowser* matb = new MissedAlarmTextBrowser ( dia, al, latest ); |
677 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); | 680 | connect( matb, SIGNAL( showIncidence( QString ) ),SLOT( showIncidence( QString ) )); |
678 | lay->addWidget( matb ); | 681 | lay->addWidget( matb ); |
679 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { | 682 | if ( QApplication::desktop()->width() == 480 || QApplication::desktop()->width() == 640 ) { |
680 | int wid = 210; | 683 | int wid = 210; |
681 | int x = QApplication::desktop()->width() - wid - 7; | 684 | int x = QApplication::desktop()->width() - wid - 7; |
682 | int y = QApplication::desktop()->height() - wid - 70; | 685 | int y = QApplication::desktop()->height() - wid - 70; |
683 | dia->setGeometry ( x,y,wid,wid); | 686 | dia->setGeometry ( x,y,wid,wid); |
@@ -2129,74 +2132,92 @@ void CalendarView::readSettings() | |||
2129 | } | 2132 | } |
2130 | sizes << resetval; | 2133 | sizes << resetval; |
2131 | if ( maxVal < resetval + resetval) | 2134 | if ( maxVal < resetval + resetval) |
2132 | resetval = maxVal - resetval; | 2135 | resetval = maxVal - resetval; |
2133 | sizes << resetval; | 2136 | sizes << resetval; |
2134 | } | 2137 | } |
2135 | mMainFrame->setSizes(sizes); | 2138 | mMainFrame->setSizes(sizes); |
2136 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); | 2139 | if ( dateCount == 5 ) mNavigator->selectWorkWeek(); |
2137 | else if ( dateCount == 7 ) mNavigator->selectWeek(); | 2140 | else if ( dateCount == 7 ) mNavigator->selectWeek(); |
2138 | else mNavigator->selectDates( dateCount ); | 2141 | else mNavigator->selectDates( dateCount ); |
2139 | // mViewManager->readSettings( config ); | 2142 | // mViewManager->readSettings( config ); |
2140 | updateConfig(); | 2143 | updateConfig(); |
2141 | globalFlagBlockAgenda = 2; | 2144 | globalFlagBlockAgenda = 2; |
2142 | mViewManager->readSettings( config ); | 2145 | mViewManager->readSettings( config ); |
2143 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); | 2146 | QTimer::singleShot( 1, mDateNavigator, SLOT ( setResizeEnabled() ) ); |
2144 | } | 2147 | } |
2145 | 2148 | ||
2146 | 2149 | ||
2147 | void CalendarView::writeSettings() | 2150 | void CalendarView::writeSettings() |
2148 | { | 2151 | { |
2149 | // kdDebug() << "CalendarView::writeSettings" << endl; | 2152 | // kdDebug() << "CalendarView::writeSettings" << endl; |
2150 | 2153 | ||
2151 | KConfig *config = KOGlobals::config(); | 2154 | KConfig *config = KOGlobals::config(); |
2152 | 2155 | ||
2153 | mViewManager->writeSettings( config ); | 2156 | mViewManager->writeSettings( config ); |
2154 | mTodoList->saveLayout(config,QString("Todo Layout")); | 2157 | mTodoList->saveLayout(config,QString("Todo Layout")); |
2155 | mDialogManager->writeSettings( config ); | 2158 | mDialogManager->writeSettings( config ); |
2156 | //KOPrefs::instance()->usrWriteConfig(); | 2159 | //KOPrefs::instance()->usrWriteConfig(); |
2157 | KOPrefs::instance()->writeConfig(); | 2160 | KOPrefs::instance()->writeConfig(); |
2158 | 2161 | ||
2159 | writeFilterSettings(config); | 2162 | writeFilterSettings(config); |
2160 | config->setGroup( "AppRun" ); | 2163 | config->setGroup( "AppRun" ); |
2161 | QDateTime dt ( QDate (2005,3,1), QTime( 0,0,0 ) ); | 2164 | QDateTime dt ( QDate (2005,1,1), QTime( 0,0,0 ) ); |
2165 | int days = dt.daysTo( QDate::currentDate() ); | ||
2166 | dt = dt.addDays( days ); | ||
2162 | int secs = dt.secsTo( QDateTime::currentDateTime() ); | 2167 | int secs = dt.secsTo( QDateTime::currentDateTime() ); |
2163 | config->writeEntry( "LatestProgramStop", secs ); | 2168 | config->writeEntry( "LatestProgramStopDays", days ); |
2164 | qDebug("KO: Writing stop time: %d ", secs); | 2169 | config->writeEntry( "LatestProgramStopSecs", secs ); |
2165 | qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); | 2170 | //qDebug("KO: Writing stop time: %d ", secs); |
2166 | QDateTime latest = dt.addSecs ( secs ); | 2171 | //qDebug("KO: Current Time %s ",QDateTime::currentDateTime().toString().latin1() ); |
2167 | qDebug("KO: Test termination on %s ", latest.toString().latin1()); | 2172 | //QDateTime latest = dt.addSecs ( secs ); |
2173 | //qDebug("KO: Termination on %s ", latest.toString().latin1()); | ||
2168 | config->setGroup( "Views" ); | 2174 | config->setGroup( "Views" ); |
2169 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); | 2175 | config->writeEntry( "ShownDatesCount", mNavigator->selectedDates().count() ); |
2170 | 2176 | ||
2177 | #if 0 | ||
2178 | qDebug("********************* "); | ||
2179 | qDebug("Testcode secsto "); | ||
2180 | QDateTime dt_nodaylight ( QDate (2005,3,26), QTime( 0,0,0 ) ); | ||
2181 | QDateTime dt_daylight ( QDate (2005,3,29), QTime( 0,0,0 ) ); | ||
2182 | int secsto = dt_nodaylight.secsTo( dt_daylight ); | ||
2183 | QDateTime dt_daylight_wrong = dt_nodaylight.addSecs( secsto ); | ||
2184 | qDebug("dt nodaylight %s ",dt_nodaylight.toString().latin1() ); | ||
2185 | qDebug("dt daylight %s ",dt_daylight.toString().latin1() ); | ||
2186 | qDebug("dt daylight_wrong %s ",dt_daylight_wrong.toString().latin1() ); | ||
2187 | qDebug("Computed secsTo %d . in minutes: %d . in hours: %d ", secsto, secsto/60, secsto/3600); | ||
2188 | qDebug("********************* testcode end"); | ||
2189 | |||
2190 | #endif | ||
2191 | |||
2171 | QValueList<int> listINT = mLeftFrame->sizes(); | 2192 | QValueList<int> listINT = mLeftFrame->sizes(); |
2172 | config->writeEntry("Left Splitter Frame",listINT); | 2193 | config->writeEntry("Left Splitter Frame",listINT); |
2173 | QValueList<int> listINT2 = mMainFrame->sizes(); | 2194 | QValueList<int> listINT2 = mMainFrame->sizes(); |
2174 | config->writeEntry("Main Splitter Frame",listINT2); | 2195 | config->writeEntry("Main Splitter Frame",listINT2); |
2175 | #ifdef DESKTOP_VERSION | 2196 | #ifdef DESKTOP_VERSION |
2176 | config->setGroup("WidgetLayout"); | 2197 | config->setGroup("WidgetLayout"); |
2177 | QStringList list ;//= config->readListEntry("MainLayout"); | 2198 | QStringList list ;//= config->readListEntry("MainLayout"); |
2178 | int x,y,w,h; | 2199 | int x,y,w,h; |
2179 | QWidget* wid; | 2200 | QWidget* wid; |
2180 | wid = topLevelWidget(); | 2201 | wid = topLevelWidget(); |
2181 | x = wid->geometry().x(); | 2202 | x = wid->geometry().x(); |
2182 | y = wid->geometry().y(); | 2203 | y = wid->geometry().y(); |
2183 | w = wid->width(); | 2204 | w = wid->width(); |
2184 | h = wid->height(); | 2205 | h = wid->height(); |
2185 | list.clear(); | 2206 | list.clear(); |
2186 | list << QString::number( x ); | 2207 | list << QString::number( x ); |
2187 | list << QString::number( y ); | 2208 | list << QString::number( y ); |
2188 | list << QString::number( w ); | 2209 | list << QString::number( w ); |
2189 | list << QString::number( h ); | 2210 | list << QString::number( h ); |
2190 | config->writeEntry("MainLayout",list ); | 2211 | config->writeEntry("MainLayout",list ); |
2191 | 2212 | ||
2192 | wid = mEventEditor; | 2213 | wid = mEventEditor; |
2193 | x = wid->geometry().x(); | 2214 | x = wid->geometry().x(); |
2194 | y = wid->geometry().y(); | 2215 | y = wid->geometry().y(); |
2195 | w = wid->width(); | 2216 | w = wid->width(); |
2196 | h = wid->height(); | 2217 | h = wid->height(); |
2197 | list.clear(); | 2218 | list.clear(); |
2198 | list << QString::number( x ); | 2219 | list << QString::number( x ); |
2199 | list << QString::number( y ); | 2220 | list << QString::number( y ); |
2200 | list << QString::number( w ); | 2221 | list << QString::number( w ); |
2201 | list << QString::number( h ); | 2222 | list << QString::number( h ); |
2202 | config->writeEntry("EditEventLayout",list ); | 2223 | config->writeEntry("EditEventLayout",list ); |
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp index c64f325..383e711 100644 --- a/microkde/kfiledialog.cpp +++ b/microkde/kfiledialog.cpp | |||
@@ -33,56 +33,56 @@ QString KFileDialog::getSaveFileName( const QString & fn, | |||
33 | int res = dia.exec(); | 33 | int res = dia.exec(); |
34 | if ( res ) | 34 | if ( res ) |
35 | retfile = o.selectedName(); | 35 | retfile = o.selectedName(); |
36 | return retfile; | 36 | return retfile; |
37 | } | 37 | } |
38 | 38 | ||
39 | QString KFileDialog::getOpenFileName( const QString & fn, | 39 | QString KFileDialog::getOpenFileName( const QString & fn, |
40 | const QString & cap, QWidget * par ) | 40 | const QString & cap, QWidget * par ) |
41 | { | 41 | { |
42 | QString retfile = ""; | 42 | QString retfile = ""; |
43 | QDialog dia ( par, "input-dialog", true ); | 43 | QDialog dia ( par, "input-dialog", true ); |
44 | // QLineEdit lab ( &dia ); | 44 | // QLineEdit lab ( &dia ); |
45 | QVBoxLayout lay( &dia ); | 45 | QVBoxLayout lay( &dia ); |
46 | lay.setMargin(7); | 46 | lay.setMargin(7); |
47 | lay.setSpacing(7); | 47 | lay.setSpacing(7); |
48 | QString file = fn; | 48 | QString file = fn; |
49 | if ( file.isEmpty() ) | 49 | if ( file.isEmpty() ) |
50 | file = QDir::homeDirPath()+"/*";; | 50 | file = QDir::homeDirPath()+"/*";; |
51 | QFileInfo fi ( file ); | 51 | QFileInfo fi ( file ); |
52 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); | 52 | OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); |
53 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); | 53 | QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); |
54 | lay.addWidget( &o); | 54 | lay.addWidget( &o); |
55 | dia.showMaximized(); | 55 | dia.showMaximized(); |
56 | dia.setCaption( cap ); | 56 | dia.setCaption( cap ); |
57 | int res = dia.exec(); | 57 | int res = dia.exec(); |
58 | if ( res ) | 58 | if ( res ) |
59 | retfile = o.selectedName(); | 59 | retfile = o.selectedName(); |
60 | return retfile; | 60 | return retfile; |
61 | } | 61 | } |
62 | QString KFileDialog::getExistingDirectory( const QString & fn, | 62 | QString KFileDialog::getExistingDirectory( const QString & fn, |
63 | const QString & cap, QWidget * par ) | 63 | const QString & cap, QWidget * par ) |
64 | { | 64 | { |
65 | return KFileDialog::getSaveFileName( fn, cap, pr ); | 65 | return KFileDialog::getSaveFileName( fn, cap, par ); |
66 | } | 66 | } |
67 | #else | 67 | #else |
68 | 68 | ||
69 | #include <qfiledialog.h> | 69 | #include <qfiledialog.h> |
70 | 70 | ||
71 | QString KFileDialog::getSaveFileName( const QString & fn, | 71 | QString KFileDialog::getSaveFileName( const QString & fn, |
72 | const QString & cap , QWidget * par ) | 72 | const QString & cap , QWidget * par ) |
73 | { | 73 | { |
74 | return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); | 74 | return QFileDialog::getSaveFileName( fn, QString::null, par, "openfile", cap ); |
75 | } | 75 | } |
76 | QString KFileDialog::getOpenFileName( const QString & fn, | 76 | QString KFileDialog::getOpenFileName( const QString & fn, |
77 | const QString & cap, QWidget * par ) | 77 | const QString & cap, QWidget * par ) |
78 | { | 78 | { |
79 | 79 | ||
80 | return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); | 80 | return QFileDialog::getOpenFileName( fn, QString::null, par, "openfile", cap ); |
81 | } | 81 | } |
82 | QString KFileDialog::getExistingDirectory( const QString & fn, | 82 | QString KFileDialog::getExistingDirectory( const QString & fn, |
83 | const QString & cap, QWidget * par ) | 83 | const QString & cap, QWidget * par ) |
84 | { | 84 | { |
85 | return QFileDialog::getExistingDirectory( fn, par, "exidtingdir", cap ); | 85 | return QFileDialog::getExistingDirectory( fn, par, "exidtingdir", cap ); |
86 | } | 86 | } |
87 | #endif | 87 | #endif |
88 | 88 | ||