Diffstat (limited to 'core/pim/datebook/datebook.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/datebook/datebook.cpp | 120 |
1 files changed, 39 insertions, 81 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index 829f8f8..4fbcb10 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp @@ -72,8 +72,2 @@ -#define DAY 1 -#define WEEK 2 -#define WEEKLST 4 -#define MONTH 3 - - DateBook::DateBook( QWidget *parent, const char *, WFlags f ) @@ -168,3 +162,3 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) - a = new QAction( tr( "Alarm and Start Time..." ), QString::null, 0, 0 ); + a = new QAction( tr( "Edit..." ), QString::null, 0, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( slotSettings() ) ); @@ -172,37 +166,12 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) - QPopupMenu *default_view = new QPopupMenu(this); - settings->insertItem( tr( "Default View" ),default_view ); - default_view->setCheckable(TRUE); + if(defaultView==DAY) viewDay(); + if(defaultView==WEEK) needEvilHack=true; // viewWeek(); + if(defaultView==WEEKLST) viewWeekLst(); + if(defaultView==MONTH) viewMonth(); - Config config("DateBook"); - config.setGroup("Main"); - int current=config.readNumEntry("defaultview", DAY); - - QActionGroup *ag = new QActionGroup(this); - a = new QAction( tr( "Day" ), QString::null, 0, 0, 0, true ); - if (current==DAY) a->setOn(true), viewDay(); - ag->insert(a); - a = new QAction( tr( "Week" ), QString::null, 0, 0, 0, true ); - if (current==WEEK) a->setOn(true), /*viewWeek(),*/ needEvilHack = true; - ag->insert(a); - a = new QAction( tr( "WeekLst" ), QString::null, 0, 0, 0, true ); - if (current==WEEKLST) a->setOn(true), viewWeekLst(); - ag->insert(a); - a = new QAction( tr( "Month" ), QString::null, 0, 0, 0, true ); - if (current==MONTH) a->setOn(true), viewMonth(); - ag->insert(a); - - ag->addTo(default_view); - connect(ag, SIGNAL( selected ( QAction * ) ), - this, SLOT( newDefaultView(QAction *) ) - ); - - connect( qApp, SIGNAL(clockChanged(bool)), - this, SLOT(changeClock(bool)) ); - connect( qApp, SIGNAL(weekChanged(bool)), - this, SLOT(changeWeek(bool)) ); + connect( qApp, SIGNAL(clockChanged(bool)), this, SLOT(changeClock(bool)) ); + connect( qApp, SIGNAL(weekChanged(bool)), this, SLOT(changeWeek(bool)) ); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) - connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), - this, SLOT(appMessage(const QCString&, const QByteArray&)) ); + connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), this, SLOT(appMessage(const QCString&, const QByteArray&)) ); #endif @@ -213,7 +182,5 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f ) QCopChannel *channel = new QCopChannel( "QPE/System", this ); - connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), - this, SLOT(receive(const QCString&, const QByteArray&)) ); + connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); channel = new QCopChannel( "QPE/Datebook", this ); - connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), - this, SLOT(receive(const QCString&, const QByteArray&)) ); + connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), this, SLOT(receive(const QCString&, const QByteArray&)) ); qDebug("olle\n"); @@ -274,2 +241,5 @@ void DateBook::slotSettings() frmSettings.setRowStyle( rowStyle ); + frmSettings.comboDefaultView->setCurrentItem(defaultView-1); + frmSettings.comboWeekListView->setCurrentItem(weeklistviewconfig); + #if defined (Q_WS_QWS) || defined(_WS_QWS_) @@ -285,2 +255,4 @@ void DateBook::slotSettings() rowStyle = frmSettings.rowStyle(); + defaultView=frmSettings.comboDefaultView->currentItem()+1; + weeklistviewconfig=frmSettings.comboWeekListView->currentItem(); @@ -302,2 +274,4 @@ void DateBook::slotSettings() weekView->redraw(); + else if ( views->visibleWidget() == weekLstView ) + weekLstView->redraw(); } @@ -385,2 +359,3 @@ void DateBook::view(int v, const QDate &d) { void DateBook::viewDefault(const QDate &d) { +/* Config config("DateBook"); @@ -390,2 +365,4 @@ void DateBook::viewDefault(const QDate &d) { view(current,d); +*/ + view(defaultView,d); } @@ -610,10 +587,7 @@ void DateBook::loadSettings() { - { - Config config( "qpe" ); - config.setGroup("Time"); - ampm = config.readBoolEntry( "AMPM", TRUE ); - onMonday = config.readBoolEntry( "MONDAY" ); - } + Config qpeconfig( "qpe" ); + qpeconfig.setGroup("Time"); + ampm = qpeconfig.readBoolEntry( "AMPM", TRUE ); + onMonday = qpeconfig.readBoolEntry( "MONDAY" ); - { Config config("DateBook"); @@ -625,3 +599,4 @@ void DateBook::loadSettings() rowStyle = config.readNumEntry("rowstyle"); - } + defaultView = config.readNumEntry("defaultview",DAY); + weeklistviewconfig = config.readNumEntry("weeklistviewconfig",NORMAL); } @@ -638,14 +613,4 @@ void DateBook::saveSettings() configDB.writeEntry("rowstyle", rowStyle); -} - -void DateBook::newDefaultView(QAction *a) { - int val=DAY; - if (a->text() == "Day") val=DAY; - if (a->text() == "Week") val=WEEK; - if (a->text() == "WeekLst") val=WEEKLST; - if (a->text() == "Month") val=MONTH; - - Config configDB( "DateBook" ); - configDB.setGroup( "Main" ); - configDB.writeEntry("defaultview",val); + configDB.writeEntry("defaultview",defaultView); + configDB.writeEntry("weeklistviewconfig",weeklistviewconfig); } @@ -664,4 +629,3 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data) QDateTime current = QDateTime::currentDateTime(); - if ( current.time().hour() != when.time().hour() - && current.time().minute() != when.time().minute() ) + if ( current.time().hour() != when.time().hour() && current.time().minute() != when.time().minute() ) return; @@ -674,4 +638,3 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data) bool found = FALSE; - for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); - it!=list.end(); ++it ) { + for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) { if ( (*it).event().hasAlarm() ) { @@ -698,3 +661,2 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data) } - QDialog dlg( this, 0, TRUE ); @@ -722,4 +684,3 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data) needShow = TRUE; - } - else { + } else { QWidget* cur = views->visibleWidget(); @@ -753,8 +714,5 @@ void DateBook::reload() db->reload(); - if ( dayAction->isOn() ) - viewDay(); - else if ( weekAction->isOn() ) - viewWeek(); - else if ( monthAction->isOn() ) - viewMonth(); + if ( dayAction->isOn() ) viewDay(); + else if ( weekAction->isOn() ) viewWeek(); + else if ( monthAction->isOn() ) viewMonth(); syncing = FALSE; @@ -773,6 +731,6 @@ void DateBook::timerEvent( QTimerEvent *e ) Sound::soundAlarm(); - } - else + } else { killTimer( e->timerId() ); } +} @@ -797,3 +755,3 @@ void DateBook::slotToday() // we need to view today using default view - viewDefault(QDate::currentDate()); + view(defaultView,QDate::currentDate()); } @@ -811,5 +769,5 @@ void DateBook::closeEvent( QCloseEvent *e ) saveSettings(); - if ( db->save() ) + if ( db->save() ) { e->accept(); - else { + } else { if ( QMessageBox::critical( this, tr( "Out of space" ), |