-rw-r--r-- | core/pim/today/today.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 51aba69..7cef035 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -54,48 +54,49 @@ int SHOW_NOTES; // show only later dates int ONLY_LATER; int AUTOSTART; int NEW_START=1; /* * Constructs a Example which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ Today::Today( QWidget* parent, const char* name, WFlags fl ) : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) { QObject::connect( (QObject*)PushButton1, SIGNAL( clicked() ), this, SLOT(startConfig() ) ); QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); #if defined(Q_WS_QWS) #if !defined(QT_NO_COP) QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this ); connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)), this, SLOT ( channelReceived(const QCString &, const QByteArray &)) ); #endif #endif + db = NULL; setOwnerField(); todo = new ToDoDB; getTodo(); draw(); autoStart(); } /* * Qcop receive method. */ void Today::channelReceived(const QCString &msg, const QByteArray & data) { QDataStream stream(data, IO_ReadOnly ); if ( msg == "message(QString)" ) { QString message; stream >> message; setOwnerField(message); } } /* * Initialises the owner field with the default value, the username */ void Today::setOwnerField() { @@ -188,49 +189,49 @@ bool Today::checkIfModified() { void Today::init() { QDate date = QDate::currentDate(); QString time = (tr( date.toString()) ); TextLabel1->setText(QString("<font color=#FFFFFF>" + time + "</font>")); // read config Config cfg("today"); cfg.setGroup("BaseConfig"); // -- config file section -- // how many lines should be showed in the task section MAX_LINES_TASK = cfg.readNumEntry("maxlinestask",5); // after how many chars should the be cut off on tasks and notes MAX_CHAR_CLIP = cfg.readNumEntry("maxcharclip",40); // how many lines should be showed in the datebook section MAX_LINES_MEET = cfg.readNumEntry("maxlinesmeet",5); // If location is to be showed too, 1 to activate it. SHOW_LOCATION = cfg.readNumEntry("showlocation",1); // if notes should be shown SHOW_NOTES = cfg.readNumEntry("shownotes",0); // should only later appointments be shown or all for the current day. ONLY_LATER = cfg.readNumEntry("onlylater",1); - db = new DateBookDB; + //db = new DateBookDB; } /* * The method for the configuration dialog. */ void Today::startConfig() { conf = new todayconfig ( this, "", true ); // read the config Config cfg("today"); cfg.setGroup("BaseConfig"); //init(); conf->SpinBox1->setValue(MAX_LINES_MEET); // location show box conf->CheckBox1->setChecked(SHOW_LOCATION); // notes show box conf->CheckBox2->setChecked(SHOW_NOTES); // task lines conf->SpinBox2->setValue(MAX_LINES_TASK); // clip when? conf->SpinBox7->setValue(MAX_CHAR_CLIP); // only later @@ -253,49 +254,54 @@ void Today::startConfig() { cfg.writeEntry("maxlinesmeet",maxmeet); cfg.writeEntry("showlocation",location); cfg.writeEntry("shownotes", notes); cfg.writeEntry("onlylater", onlylater); cfg.setGroup("Autostart"); cfg.writeEntry("autostart", autostart); // sync it to "disk" cfg.write(); NEW_START=1; draw(); autoStart(); } /* * Get all events that are in the datebook xml file for today */ void Today::getDates() { QDate date = QDate::currentDate(); if (AllDateBookEvents) delete AllDateBookEvents; AllDateBookEvents = new QWidget( ); QVBoxLayout* layoutDates = new QVBoxLayout(AllDateBookEvents); - + + if (db) { + delete db; + } + db = new DateBookDB; + QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); qBubbleSort(list); // printf("Get dates\n"); Config config( "qpe" ); // if 24 h format //bool ampm = config.readBoolEntry( "AMPM", TRUE ); int count=0; if ( list.count() > 0 ) { for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); it!=list.end(); ++it ) { if ( count <= MAX_LINES_MEET ) { QTime time = QTime::currentTime(); if (!ONLY_LATER) { count++; DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); |