summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/datebook/datebook.cpp14
-rw-r--r--core/pim/datebook/datebook.h2
-rw-r--r--core/pim/datebook/datebook.pro3
-rw-r--r--core/pim/datebook/datebookday.cpp53
-rw-r--r--core/pim/datebook/datebookday.h6
-rw-r--r--core/pim/datebook/datebooksettings.cpp20
-rw-r--r--core/pim/datebook/datebooksettings.h5
-rw-r--r--core/pim/datebook/datebooksettingsbase.ui197
-rw-r--r--core/pim/datebook/datebookweeklst.cpp2
9 files changed, 281 insertions, 21 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp
index c0d45c9..7dd93a6 100644
--- a/core/pim/datebook/datebook.cpp
+++ b/core/pim/datebook/datebook.cpp
@@ -79,8 +79,10 @@ DateBook::DateBook( QWidget *parent, const char *, WFlags f )
: QMainWindow( parent, "datebook", f ),
aPreset( FALSE ),
presetTime( -1 ),
startTime( 8 ), // an acceptable default
+ rowStyle( 0 ),
+ bJumpToCurTime(FALSE),
syncing(FALSE),
inSearch(FALSE),
alarmCounter(0)
{
@@ -248,18 +250,24 @@ void DateBook::slotSettings()
{
DateBookSettings frmSettings( ampm, this );
frmSettings.setStartTime( startTime );
frmSettings.setAlarmPreset( aPreset, presetTime );
+ frmSettings.setJumpToCurTime( bJumpToCurTime );
+ frmSettings.setRowStyle( rowStyle );
#if defined (Q_WS_QWS) || defined(_WS_QWS_)
frmSettings.showMaximized();
#endif
if ( frmSettings.exec() ) {
aPreset = frmSettings.alarmPreset();
presetTime = frmSettings.presetTime();
startTime = frmSettings.startTime();
+ bJumpToCurTime = frmSettings.jumpToCurTime();
+ rowStyle = frmSettings.rowStyle();
if ( dayView )
dayView->setStartViewTime( startTime );
+ dayView->setJumpToCurTime( bJumpToCurTime );
+ dayView->setRowStyle( rowStyle );
if ( weekView )
weekView->setStartViewTime( startTime );
saveSettings();
@@ -452,8 +460,10 @@ void DateBook::initDay()
if ( !dayView ) {
dayView = new DateBookDay( ampm, onMonday, db, views, "day view" );
views->addWidget( dayView, DAY );
dayView->setStartViewTime( startTime );
+ dayView->setJumpToCurTime( bJumpToCurTime );
+ dayView->setRowStyle( rowStyle );
connect( this, SIGNAL( newEvent() ),
dayView, SLOT( redraw() ) );
connect( dayView, SIGNAL( newEvent() ),
this, SLOT( fileNew() ) );
@@ -546,8 +556,10 @@ void DateBook::loadSettings()
config.setGroup("Main");
startTime = config.readNumEntry("startviewtime", 8);
aPreset = config.readBoolEntry("alarmpreset");
presetTime = config.readNumEntry("presettime");
+ bJumpToCurTime = config.readBoolEntry("jumptocurtime");
+ rowStyle = config.readNumEntry("rowstyle");
}
}
void DateBook::saveSettings()
@@ -557,8 +569,10 @@ void DateBook::saveSettings()
configDB.setGroup( "Main" );
configDB.writeEntry("startviewtime",startTime);
configDB.writeEntry("alarmpreset",aPreset);
configDB.writeEntry("presettime",presetTime);
+ configDB.writeEntry("jumptocurtime", bJumpToCurTime);
+ configDB.writeEntry("rowstyle", rowStyle);
}
void DateBook::newDefaultView(QAction *a) {
int val=DAY;
diff --git a/core/pim/datebook/datebook.h b/core/pim/datebook/datebook.h
index e7be0dd..ba8f97e 100644
--- a/core/pim/datebook/datebook.h
+++ b/core/pim/datebook/datebook.h
@@ -113,8 +113,10 @@ private:
QAction *dayAction, *weekAction, *weekLstAction, *monthAction;
bool aPreset; // have everything set to alarm?
int presetTime; // the standard time for the alarm
int startTime;
+ int rowStyle;
+ bool bJumpToCurTime; //should jump to current time in dayview?
bool ampm;
bool onMonday;
bool syncing;
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro
index 609b7dc..1db3e3a 100644
--- a/core/pim/datebook/datebook.pro
+++ b/core/pim/datebook/datebook.pro
@@ -6,8 +6,9 @@ HEADERS = datebookday.h \
datebook.h \
dateentryimpl.h \
datebookdayheaderimpl.h \
datebooksettings.h \
+ datebooksettingsbase.h \
datebookweek.h \
datebookweeklst.h \
datebookweekheaderimpl.h \
repeatentry.h \
@@ -19,8 +20,9 @@ SOURCES = main.cpp \
datebookday.cpp \
datebook.cpp \
dateentryimpl.cpp \
datebookdayheaderimpl.cpp \
+ datebooksettingsbase.cpp \
datebooksettings.cpp \
datebookweek.cpp \
datebookweeklst.cpp \
datebookweekheaderimpl.cpp \
@@ -30,9 +32,8 @@ SOURCES = main.cpp \
onoteedit.cpp
INTERFACES = dateentry.ui \
datebookdayheader.ui \
- datebooksettingsbase.ui \
datebookweekheader.ui \
datebookweeklstheader.ui \
datebookweeklstdayhdr.ui \
repeatentrybase.ui \
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp
index c15ccef..9cc5fcd 100644
--- a/core/pim/datebook/datebookday.cpp
+++ b/core/pim/datebook/datebookday.cpp
@@ -59,9 +59,9 @@ DateBookDayView::DateBookDayView( bool whichClock, QWidget *parent,
int row;
for ( row = 0; row < numRows(); row++ ) {
tmp = new QTableItem( this, QTableItem::Never, QString::null);
setItem( row, 0, tmp );
- setRowHeight( row, 40);
+ //setRowHeight( row, 40);
}
initHeader();
QObject::connect( qApp, SIGNAL(clockChanged(bool)),
this, SLOT(slotChangeClock(bool)) );
@@ -158,8 +158,15 @@ void DateBookDayView::keyPressEvent( QKeyEvent *e )
e->ignore();
}
}
+void DateBookDayView::setRowStyle( int style )
+{
+ if (style<0) style = 0;
+
+ for (int i=0; i<numRows(); i++)
+ setRowHeight(i, style*10+20);
+}
//===========================================================================
DateBookDay::DateBookDay( bool ampm, bool startOnMonday,
@@ -173,8 +180,9 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday,
widgetList.setAutoDelete( true );
header = new DateBookDayHeader( startOnMonday, this, "day header" );
header->setDate( currDate.year(), currDate.month(), currDate.day() );
view = new DateBookDayView( ampm, this, "day view" );
+
connect( header, SIGNAL( dateChanged( int, int, int ) ),
this, SLOT( dateChanged( int, int, int ) ) );
connect( view, SIGNAL( sigColWidthChanged() ),
this, SLOT( slotColWidthChanged() ) );
@@ -192,8 +200,20 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday,
selectedWidget = 0;
timeMarker = new DateBookDayTimeMarker( this );
timeMarker->setTime( QTime::currentTime() );
+ rowStyle = -1; // initialize with bogus values
+}
+
+void DateBookDay::setJumpToCurTime( bool bJump )
+{
+ jumpToCurTime = bJump;
+}
+
+void DateBookDay::setRowStyle( int style )
+{
+ if (rowStyle != style) view->setRowStyle( style );
+ rowStyle = style;
}
void DateBookDay::updateView( void )
{
@@ -256,17 +276,23 @@ void DateBookDay::dateChanged( int y, int m, int d )
currDate.setYMD( y, m, d );
relayoutPage();
dayView()->clearSelection();
QTableSelection ts;
+
+ if (jumpToCurTime && this->date() == QDate::currentDate())
+ {
+ ts.init( QTime::currentTime().hour(), 0);
+ ts.expandTo( QTime::currentTime().hour(), 0);
+ } else
+ {
ts.init( startTime, 0 );
ts.expandTo( startTime, 0 );
+ }
+
dayView()->addSelection( ts );
selectedWidget = 0;
- if (this->date() == QDate::currentDate())
- timeMarker->show(); else timeMarker->hide();
-
}
void DateBookDay::redraw()
{
@@ -398,8 +424,11 @@ void DateBookDay::relayoutPage( bool fromResize )
}
w->setGeometry( geom );
}
+ if (jumpToCurTime && this->date() == QDate::currentDate())
+ view->setContentsPos( 0, QTime::currentTime().hour() * view->rowHeight(0) ); //set listview to current hour
+ else
view->setContentsPos( 0, startTime * view->rowHeight(0) );
} else {
@@ -443,13 +472,20 @@ void DateBookDay::relayoutPage( bool fromResize )
geom.setWidth( wid );
w->setGeometry( geom );
}
}
+
+ if (jumpToCurTime && this->date() == QDate::currentDate())
+ view->setContentsPos( 0, QTime::currentTime().hour() * view->rowHeight(0) ); //set listview to current hour
+ else
view->setContentsPos( 0, startTime * view->rowHeight(0) );
}
timeMarker->setTime( QTime::currentTime() ); //display timeMarker
timeMarker->raise(); //on top of all widgets
+ if (this->date() == QDate::currentDate()) //only show timeMarker on current day
+ timeMarker->show(); else timeMarker->hide();
+
setUpdatesEnabled( TRUE );
return;
}
@@ -478,10 +514,19 @@ void DateBookDay::setStartViewTime( int startHere )
{
startTime = startHere;
dayView()->clearSelection();
QTableSelection ts;
+
+ if (jumpToCurTime && this->date() == QDate::currentDate()) //this should probably be in datebook.cpp where it's called?
+ {
+ ts.init( QTime::currentTime().hour(), 0);
+ ts.expandTo( QTime::currentTime().hour(), 0);
+ } else
+ {
ts.init( startTime, 0 );
ts.expandTo( startTime, 0 );
+ }
+
dayView()->addSelection( ts );
}
int DateBookDay::startViewTime() const
diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h
index db0f3b6..be7cc45 100644
--- a/core/pim/datebook/datebookday.h
+++ b/core/pim/datebook/datebookday.h
@@ -40,8 +40,10 @@ class DateBookDayView : public QTable
public:
DateBookDayView( bool hourClock, QWidget *parent, const char *name );
bool whichClock() const;
+ void setRowStyle( int style );
+
public slots:
void moveUp();
void moveDown();
@@ -148,8 +150,10 @@ public:
void setStartViewTime( int startHere );
int startViewTime() const;
void setSelectedWidget( DateBookDayWidget * );
DateBookDayWidget * getSelectedWidget( void );
+ void setJumpToCurTime( bool bJump );
+ void setRowStyle( int style );
public slots:
void setDate( int y, int m, int d );
void setDate( QDate );
@@ -180,8 +184,10 @@ private:
DateBookDayHeader *header;
DateBookDB *db;
WidgetListClass widgetList; //reimplemented QList for sorting widgets by height
int startTime;
+ bool jumpToCurTime; //should we jump to current time in dayview?
+ int rowStyle;
DateBookDayWidget *selectedWidget; //actual selected widget (obviously)
DateBookDayTimeMarker *timeMarker; //marker for current time
};
diff --git a/core/pim/datebook/datebooksettings.cpp b/core/pim/datebook/datebooksettings.cpp
index c5d8ac1..49fcd17 100644
--- a/core/pim/datebook/datebooksettings.cpp
+++ b/core/pim/datebook/datebooksettings.cpp
@@ -132,4 +132,24 @@ void DateBookSettings::slotChangeClock( bool whichClock )
ampm = whichClock;
init();
setStartTime( saveMe );
}
+
+void DateBookSettings::setJumpToCurTime( bool bJump )
+{
+ chkJumpToCurTime->setChecked( bJump );
+}
+
+bool DateBookSettings::jumpToCurTime() const
+{
+ return chkJumpToCurTime->isChecked();
+}
+
+void DateBookSettings::setRowStyle( int style )
+{
+ comboRowStyle->setCurrentItem( style );
+}
+
+int DateBookSettings::rowStyle() const
+{
+ return comboRowStyle->currentItem();
+}
diff --git a/core/pim/datebook/datebooksettings.h b/core/pim/datebook/datebooksettings.h
index ee9f39c..90a07f9 100644
--- a/core/pim/datebook/datebooksettings.h
+++ b/core/pim/datebook/datebooksettings.h
@@ -35,8 +35,13 @@ public:
int presetTime() const;
void setAlarmType( int alarmType );
int alarmType() const;
+ void setJumpToCurTime( bool bJump );
+ bool jumpToCurTime() const;
+ void setRowStyle( int style );
+ int rowStyle() const;
+
private slots:
void slot12Hour( int );
void slotChangeClock( bool );
diff --git a/core/pim/datebook/datebooksettingsbase.ui b/core/pim/datebook/datebooksettingsbase.ui
index 0f40773..816a441 100644
--- a/core/pim/datebook/datebooksettingsbase.ui
+++ b/core/pim/datebook/datebooksettingsbase.ui
@@ -31,9 +31,9 @@
<name>geometry</name>
<rect>
<x>0</x>
<y>0</y>
- <width>232</width>
+ <width>220</width>
<height>290</height>
</rect>
</property>
<property stdset="1">
@@ -45,18 +45,18 @@
</property>
<property>
<name>layoutSpacing</name>
</property>
- <vbox>
+ <grid>
<property stdset="1">
<name>margin</name>
- <number>5</number>
+ <number>11</number>
</property>
<property stdset="1">
<name>spacing</name>
- <number>1</number>
+ <number>6</number>
</property>
- <widget>
+ <widget row="0" column="0" >
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>fraStart</cstring>
@@ -72,18 +72,54 @@
<property stdset="1">
<name>title</name>
<string>Start viewing events</string>
</property>
- <vbox>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <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>
+ </property>
+ <grid>
<property stdset="1">
<name>margin</name>
- <number>11</number>
+ <number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
- <widget>
+ <spacer row="1" column="0" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer1</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</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>
+ <widget row="0" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout1</cstring>
@@ -128,11 +164,12 @@
</property>
</widget>
</hbox>
</widget>
- </vbox>
+ </grid>
</widget>
- <widget>
+ </widget>
+ <widget row="1" column="0" >
<class>QGroupBox</class>
<property stdset="1">
<name>name</name>
<cstring>fraAlarm</cstring>
@@ -140,18 +177,54 @@
<property stdset="1">
<name>title</name>
<string>Alarm Settings</string>
</property>
- <vbox>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <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>
+ </property>
+ <grid>
<property stdset="1">
<name>margin</name>
- <number>11</number>
+ <number>0</number>
</property>
<property stdset="1">
<name>spacing</name>
<number>6</number>
</property>
- <widget>
+ <spacer row="1" column="0" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</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>
+ <widget row="0" column="0" >
<class>QLayoutWidget</class>
<property stdset="1">
<name>name</name>
<cstring>Layout6</cstring>
@@ -208,11 +281,105 @@
</property>
</widget>
</hbox>
</widget>
- </vbox>
+ </grid>
+ </widget>
+ </widget>
+ <widget row="2" column="0" >
+ <class>QGroupBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>fraMisc</cstring>
+ </property>
+ <property stdset="1">
+ <name>title</name>
+ <string>Misc</string>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <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>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Row style:</string>
+ </property>
+ </widget>
+ <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>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>chkJumpToCurTime</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>10</x>
+ <y>20</y>
+ <width>200</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Jump to current time (dayview)</string>
+ </property>
+ </widget>
</widget>
- </vbox>
+ </grid>
</widget>
<connections>
<connection>
<sender>chkAlarmPreset</sender>
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp
index 8e88377..58a9c53 100644
--- a/core/pim/datebook/datebookweeklst.cpp
+++ b/core/pim/datebook/datebookweeklst.cpp
@@ -26,9 +26,9 @@
bool calcWeek(const QDate &d, int &week, int &year,
bool startOnMonday = false);
-DateBookWeekLstHeader::DateBookWeekLstHeader(bool onM, QWidget* parent,
+DateBookWeekLstHeader::DateBookWeekLstHeader(bool /*onM*/, QWidget* parent,
const char* name, WFlags fl)
: DateBookWeekLstHeaderBase(parent, name, fl)
{
setBackgroundMode( PaletteButton );