summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp120
-rw-r--r--core/pim/datebook/datebook.h6
-rw-r--r--core/pim/datebook/datebooksettingsbase.ui394
-rw-r--r--core/pim/datebook/datebookweeklst.cpp123
-rw-r--r--core/pim/datebook/datebookweeklst.h2
5 files changed, 396 insertions, 249 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" ),
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h
index 623862b..5216770 100644
--- a/core/pim/datebook/datebook.h
+++ b/core/pim/datebook/datebook.h
@@ -26,2 +26,5 @@
+enum { DAY=1,WEEK,WEEKLST,MONTH }; // defaultView values
+enum { NONE=0,NORMAL,EXTENDED }; // WeekLstView's modes.
+
class QAction;
@@ -69,3 +72,2 @@ private slots:
void slotSettings();
- void newDefaultView(QAction *a);
void slotToday(); // view today
@@ -114,2 +116,3 @@ private:
QAction *dayAction, *weekAction, *weekLstAction, *monthAction;
+ int weeklistviewconfig;
bool aPreset; // have everything set to alarm?
@@ -118,2 +121,3 @@ private:
int rowStyle;
+ int defaultView;
bool bJumpToCurTime; //should jump to current time in dayview?
diff --git a/core/pim/datebook/datebooksettingsbase.ui b/core/pim/datebook/datebooksettingsbase.ui
index 816a441..3836330 100644
--- a/core/pim/datebook/datebooksettingsbase.ui
+++ b/core/pim/datebook/datebooksettingsbase.ui
@@ -34,4 +34,4 @@
<y>0</y>
- <width>220</width>
- <height>290</height>
+ <width>273</width>
+ <height>303</height>
</rect>
@@ -48,3 +48,3 @@
</property>
- <grid>
+ <vbox>
<property stdset="1">
@@ -57,19 +57,26 @@
</property>
- <widget row="0" column="0" >
- <class>QGroupBox</class>
+ <widget>
+ <class>QTabWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>fraStart</cstring>
+ <cstring>TabWidget2</cstring>
</property>
+ <widget>
+ <class>QWidget</class>
<property stdset="1">
- <name>frameShape</name>
- <enum>Box</enum>
+ <name>name</name>
+ <cstring>tab</cstring>
</property>
+ <attribute>
+ <name>title</name>
+ <string>Views</string>
+ </attribute>
+ <vbox>
<property stdset="1">
- <name>frameShadow</name>
- <enum>Sunken</enum>
+ <name>margin</name>
+ <number>11</number>
</property>
<property stdset="1">
- <name>title</name>
- <string>Start viewing events</string>
+ <name>spacing</name>
+ <number>6</number>
</property>
@@ -79,14 +86,5 @@
<name>name</name>
- <cstring>Layout6</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>3</x>
- <y>21</y>
- <width>210</width>
- <height>53</height>
- </rect>
+ <cstring>Layout5</cstring>
</property>
- <grid>
+ <hbox>
<property stdset="1">
@@ -99,3 +97,3 @@
</property>
- <spacer row="1" column="0" >
+ <spacer>
<property>
@@ -106,3 +104,3 @@
<name>orientation</name>
- <enum>Vertical</enum>
+ <enum>Horizontal</enum>
</property>
@@ -120,12 +118,81 @@
</spacer>
- <widget row="0" column="0" >
- <class>QLayoutWidget</class>
+ <widget>
+ <class>QLabel</class>
<property stdset="1">
<name>name</name>
- <cstring>Layout1</cstring>
+ <cstring>TextLabel1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Default view:</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Day</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Week</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Week List</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Month</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>comboDefaultView</cstring>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox4</cstring>
</property>
- <hbox>
+ <property stdset="1">
+ <name>title</name>
+ <string>Day</string>
+ </property>
+ <vbox>
<property stdset="1">
<name>margin</name>
- <number>0</number>
+ <number>11</number>
</property>
@@ -136,6 +203,6 @@
<widget>
- <class>QLabel</class>
+ <class>QCheckBox</class>
<property stdset="1">
<name>name</name>
- <cstring>lblStartTime</cstring>
+ <cstring>chkJumpToCurTime</cstring>
</property>
@@ -143,3 +210,3 @@
<name>text</name>
- <string>Start Time:</string>
+ <string>Jump to current time</string>
</property>
@@ -147,26 +214,57 @@
<widget>
- <class>QSpinBox</class>
+ <class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
- <cstring>spinStart</cstring>
+ <cstring>Layout5</cstring>
</property>
+ <hbox>
<property stdset="1">
- <name>suffix</name>
- <string>:00</string>
+ <name>margin</name>
+ <number>0</number>
</property>
<property stdset="1">
- <name>wrapping</name>
- <bool>true</bool>
+ <name>spacing</name>
+ <number>6</number>
</property>
+ <widget>
+ <class>QLabel</class>
<property stdset="1">
- <name>maxValue</name>
- <number>23</number>
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Row style:</string>
</property>
</widget>
- </hbox>
+ <widget>
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Default</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Medium</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Large</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>comboRowStyle</cstring>
+ </property>
</widget>
- </grid>
+ </hbox>
</widget>
+ </vbox>
</widget>
- <widget row="1" column="0" >
+ <widget>
<class>QGroupBox</class>
@@ -174,3 +272,3 @@
<name>name</name>
- <cstring>fraAlarm</cstring>
+ <cstring>GroupBox5</cstring>
</property>
@@ -178,3 +276,12 @@
<name>title</name>
- <string>Alarm Settings</string>
+ <string>Week List</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
</property>
@@ -184,14 +291,5 @@
<name>name</name>
- <cstring>Layout4</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>10</x>
- <y>20</y>
- <width>200</width>
- <height>53</height>
- </rect>
+ <cstring>Layout6</cstring>
</property>
- <grid>
+ <hbox>
<property stdset="1">
@@ -204,6 +302,46 @@
</property>
- <spacer row="1" column="0" >
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Time display</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QComboBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>None</string>
+ </property>
+ </item>
+ <item>
+ <property>
+ <name>text</name>
+ <string>Start</string>
+ </property>
+ </item>
+ <item>
<property>
+ <name>text</name>
+ <string>Start-End</string>
+ </property>
+ </item>
+ <property stdset="1">
<name>name</name>
- <cstring>Spacer2</cstring>
+ <cstring>comboWeekListView</cstring>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer3_2</cstring>
</property>
@@ -225,3 +363,43 @@
</spacer>
- <widget row="0" column="0" >
+ </vbox>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>Misc</string>
+ </attribute>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>GroupBox6</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Alarm Settings</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
<class>QLayoutWidget</class>
@@ -284,6 +462,5 @@
</widget>
- </grid>
- </widget>
+ </vbox>
</widget>
- <widget row="2" column="0" >
+ <widget>
<class>QGroupBox</class>
@@ -291,3 +468,3 @@
<name>name</name>
- <cstring>fraMisc</cstring>
+ <cstring>GroupBox7</cstring>
</property>
@@ -295,3 +472,12 @@
<name>title</name>
- <string>Misc</string>
+ <string>Start viewing events</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
</property>
@@ -301,12 +487,3 @@
<name>name</name>
- <cstring>Layout5</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>10</x>
- <y>40</y>
- <width>170</width>
- <height>24</height>
- </rect>
+ <cstring>Layout1</cstring>
</property>
@@ -325,3 +502,3 @@
<name>name</name>
- <cstring>TextLabel1</cstring>
+ <cstring>lblStartTime</cstring>
</property>
@@ -329,3 +506,3 @@
<name>text</name>
- <string>Row style:</string>
+ <string>Start Time:</string>
</property>
@@ -333,24 +510,18 @@
<widget>
- <class>QComboBox</class>
- <item>
- <property>
- <name>text</name>
- <string>Default</string>
+ <class>QSpinBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>spinStart</cstring>
</property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>Medium</string>
+ <property stdset="1">
+ <name>suffix</name>
+ <string>:00</string>
</property>
- </item>
- <item>
- <property>
- <name>text</name>
- <string>Large</string>
+ <property stdset="1">
+ <name>wrapping</name>
+ <bool>true</bool>
</property>
- </item>
<property stdset="1">
- <name>name</name>
- <cstring>comboRowStyle</cstring>
+ <name>maxValue</name>
+ <number>23</number>
</property>
@@ -359,24 +530,29 @@
</widget>
- <widget>
- <class>QCheckBox</class>
- <property stdset="1">
+ </vbox>
+ </widget>
+ <spacer>
+ <property>
<name>name</name>
- <cstring>chkJumpToCurTime</cstring>
+ <cstring>Spacer9</cstring>
</property>
<property stdset="1">
- <name>geometry</name>
- <rect>
- <x>10</x>
- <y>20</y>
- <width>200</width>
- <height>20</height>
- </rect>
+ <name>orientation</name>
+ <enum>Vertical</enum>
</property>
<property stdset="1">
- <name>text</name>
- <string>Jump to current time (dayview)</string>
+ <name>sizeType</name>
+ <enum>Expanding</enum>
</property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
</widget>
</widget>
- </grid>
+ </vbox>
</widget>
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index 3d6a029..3c8fc89 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -4,2 +4,4 @@
+#include "datebook.h"
+
#include <qpe/calendar.h>
@@ -145,20 +147,40 @@ void DateBookWeekLstDayHdr::newEvent() {
DateBookWeekLstEvent::DateBookWeekLstEvent(const EffectiveEvent &ev,
+ int weeklistviewconfig,
QWidget* parent,
const char* name,
- WFlags fl) :
- OClickableLabel(parent,name,fl),
- event(ev)
+ WFlags fl ) : OClickableLabel(parent,name,fl), event(ev)
{
- char s[10];
- if ( ev.startDate() != ev.date() ) { // multiday event (not first day)
- if ( ev.endDate() == ev.date() ) { // last day
- strcpy(s, "__|__");
- } else {
- strcpy(s, " |---");
+ // old values... lastday = "__|__", middle=" |---", Firstday="00:00",
+ QString s,start,middle,end,day;
+
+ qDebug("weeklistviewconfig=%d",weeklistviewconfig);
+ if(weeklistviewconfig==NONE) { // No times displayed.
+// start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute());
+// middle.sprintf("<--->");
+// end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute());
+// day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute());
+ } else if(weeklistviewconfig==NORMAL) { // "Normal", only display start time.
+ start.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute());
+ middle.sprintf(" |---");
+ end.sprintf("__|__");
+ day.sprintf("%.2d:%.2d",ev.start().hour(),ev.start().minute());
+ } else if(weeklistviewconfig==EXTENDED) { // Extended mode, display start and end times.
+ start.sprintf("%.2d:%.2d-",ev.start().hour(),ev.start().minute());
+ middle.sprintf("<--->");
+ end.sprintf("-%.2d:%.2d",ev.end().hour(),ev.end().minute());
+ day.sprintf("%.2d:%.2d-%.2d:%.2d",ev.start().hour(),ev.start().minute(),ev.end().hour(),ev.end().minute());
+ }
+
+ if(ev.event().type() == Event::Normal) {
+ if(ev.startDate()==ev.date() && ev.endDate()==ev.date()) { // day event.
+ s=day;
+ } else if(ev.startDate()==ev.date()) { // start event.
+ s=start;
+ } else if(ev.endDate()==ev.date()) { // end event.
+ s=end;
+ } else { // middle day.
+ s=middle;
}
} else {
- if(ev.event().type() == Event::Normal )
- sprintf(s,"%.2d:%.2d",ev.start().hour(),ev.start().minute());
- else
- sprintf(s," ");
+ s="";
}
@@ -179,2 +201,7 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
{
+ Config config("DateBook");
+ config.setGroup("Main");
+ int weeklistviewconfig=config.readNumEntry("weeklistviewconfig", NORMAL);
+ qDebug("Read weeklistviewconfig: %d",weeklistviewconfig);
+
onMonday=onM;
@@ -190,5 +217,5 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
int dayOrder[7];
- if (onMonday)
+ if (onMonday) {
for (int d=0; d<7; d++) dayOrder[d]=d+1;
- else {
+ } else {
for (int d=0; d<7; d++) dayOrder[d]=d;
@@ -199,12 +226,7 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
// Header
- DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i),
- onMonday,this);
+ DateBookWeekLstDayHdr *hdr=new DateBookWeekLstDayHdr(d.addDays(i), onMonday,this);
connect(hdr, SIGNAL(showDate(int,int,int)),
this, SIGNAL(showDate(int,int,int)));
- connect(hdr, SIGNAL(addEvent(const QDateTime &,
- const QDateTime &,
- const QString &, const QString &)),
- this, SIGNAL(addEvent(const QDateTime &,
- const QDateTime &,
- const QString &, const QString &)));
+ connect(hdr, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)),
+ this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
layout->addWidget(hdr);
@@ -214,6 +236,5 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev,
if(!(((*it).end().hour()==0) && ((*it).end().minute()==0) && ((*it).startDate()!=(*it).date()))) { // Skip events ending at 00:00 starting at another day.
- DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,this);
+ DateBookWeekLstEvent *l=new DateBookWeekLstEvent(*it,weeklistviewconfig,this);
layout->addWidget(l);
- connect (l, SIGNAL(editEvent(const Event &)),
- this, SIGNAL(editEvent(const Event &)));
+ connect (l, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &)));
}
@@ -239,10 +260,6 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
layout->addWidget(w);
- connect (w, SIGNAL(editEvent(const Event &)),
- this, SIGNAL(editEvent(const Event &)));
- connect (w, SIGNAL(showDate(int,int,int)),
- this, SIGNAL(showDate(int,int,int)));
- connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &,const QString &)),
- this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &, const QString &)));
+ connect (w, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &)));
+ connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
+ connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &,const QString &)),
+ this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
@@ -251,10 +268,6 @@ DateBookWeekLstDblView::DateBookWeekLstDblView(QValueList<EffectiveEvent> &ev1,
layout->addWidget(w);
- connect (w, SIGNAL(editEvent(const Event &)),
- this, SIGNAL(editEvent(const Event &)));
- connect (w, SIGNAL(showDate(int,int,int)),
- this, SIGNAL(showDate(int,int,int)));
- connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &, const QString &)),
- this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &, const QString &)));
+ connect (w, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &)));
+ connect (w, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
+ connect (w, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)),
+ this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
}
@@ -276,6 +289,4 @@ DateBookWeekLst::DateBookWeekLst( bool ap, bool onM, DateBookDB *newDB,
layout->addWidget( header );
- connect(header, SIGNAL(dateChanged(int,int)),
- this, SLOT(dateChanged(int,int)));
- connect(header, SIGNAL(setDbl(bool)),
- this, SLOT(setDbl(bool)));
+ connect(header, SIGNAL(dateChanged(int,int)), this, SLOT(dateChanged(int,int)));
+ connect(header, SIGNAL(setDbl(bool)), this, SLOT(setDbl(bool)));
@@ -318,4 +329,7 @@ QDate DateBookWeekLst::date() const {
if (!onMonday)
- if (dow==7) dow=1;
- else dow++;
+ if (dow==7) {
+ dow=1;
+ } else {
+ dow++;
+ }
@@ -335,3 +349,2 @@ void DateBookWeekLst::getEvents() {
QValueList<EffectiveEvent> el2 = db->getEffectiveEvents(start2, stop);
-
view=new DateBookWeekLstDblView(el,el2,start,onMonday,scroll);
@@ -341,10 +354,6 @@ void DateBookWeekLst::getEvents() {
- connect (view, SIGNAL(editEvent(const Event &)),
- this, SIGNAL(editEvent(const Event &)));
- connect (view, SIGNAL(showDate(int,int,int)),
- this, SIGNAL(showDate(int,int,int)));
- connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &, const QString &)),
- this, SIGNAL(addEvent(const QDateTime &, const QDateTime &,
- const QString &, const QString &)));
+ connect (view, SIGNAL(editEvent(const Event &)), this, SIGNAL(editEvent(const Event &)));
+ connect (view, SIGNAL(showDate(int,int,int)), this, SIGNAL(showDate(int,int,int)));
+ connect (view, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)),
+ this, SIGNAL(addEvent(const QDateTime &, const QDateTime &, const QString &, const QString &)));
diff --git a/core/pim/datebook/datebookweeklst.h b/core/pim/datebook/datebookweeklst.h
index ea88f20..17dc01f 100644
--- a/core/pim/datebook/datebookweeklst.h
+++ b/core/pim/datebook/datebookweeklst.h
@@ -61,3 +61,3 @@ class DateBookWeekLstEvent: public OClickableLabel
public:
- DateBookWeekLstEvent(const EffectiveEvent &ev,
+ DateBookWeekLstEvent(const EffectiveEvent &ev, int weeklistviewconfig =1,
QWidget* parent = 0, const char* name = 0,