summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/datebook/datebookweekheader.ui198
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.cpp64
-rw-r--r--core/pim/datebook/datebookweekheaderimpl.h12
3 files changed, 252 insertions, 22 deletions
diff --git a/core/pim/datebook/datebookweekheader.ui b/core/pim/datebook/datebookweekheader.ui
index f7b20f8..591b625 100644
--- a/core/pim/datebook/datebookweekheader.ui
+++ b/core/pim/datebook/datebookweekheader.ui
@@ -32,4 +32,4 @@
<y>0</y>
- <width>281</width>
- <height>30</height>
+ <width>249</width>
+ <height>26</height>
</rect>
@@ -49,5 +49,75 @@
<name>spacing</name>
- <number>6</number>
+ <number>0</number>
</property>
<widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>backmonth</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>pixmap</name>
+ <pixmap></pixmap>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRepeat</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>false</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string></string>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>backweek</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>pixmap</name>
+ <pixmap></pixmap>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRepeat</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>toggleButton</name>
+ <bool>false</bool>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string></string>
+ </property>
+ </widget>
+ <widget>
<class>QSpinBox</class>
@@ -111,4 +181,25 @@
</widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer1_1</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>
<widget>
- <class>QLabel</class>
+ <class>QToolButton</class>
<property stdset="1">
@@ -134,8 +225,68 @@
</property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer1_2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
<property stdset="1">
- <name>alignment</name>
- <set>AlignCenter</set>
+ <name>sizeType</name>
+ <enum>Expanding</enum>
</property>
<property>
- <name>hAlign</name>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>forwardweek</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>pixmap</name>
+ <pixmap></pixmap>
+ </property>
+ <property stdset="1">
+ <name>autoRepeat</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget>
+ <class>QToolButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>forwardmonth</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>pixmap</name>
+ <pixmap></pixmap>
+ </property>
+ <property stdset="1">
+ <name>autoRepeat</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>autoRaise</name>
+ <bool>true</bool>
</property>
@@ -146,12 +297,30 @@
<connection>
- <sender>spinYear</sender>
- <signal>valueChanged(int)</signal>
+ <sender>backmonth</sender>
+ <signal>clicked()</signal>
+ <receiver>DateBookWeekHeaderBase</receiver>
+ <slot>prevMonth()</slot>
+ </connection>
+ <connection>
+ <sender>backweek</sender>
+ <signal>clicked()</signal>
+ <receiver>DateBookWeekHeaderBase</receiver>
+ <slot>prevWeek()</slot>
+ </connection>
+ <connection>
+ <sender>forwardweek</sender>
+ <signal>clicked()</signal>
+ <receiver>DateBookWeekHeaderBase</receiver>
+ <slot>nextWeek()</slot>
+ </connection>
+ <connection>
+ <sender>forwardmonth</sender>
+ <signal>clicked()</signal>
<receiver>DateBookWeekHeaderBase</receiver>
- <slot>yearChanged( int )</slot>
+ <slot>nextMonth()</slot>
</connection>
<connection>
- <sender>spinWeek</sender>
- <signal>valueChanged(int)</signal>
+ <sender>labelDate</sender>
+ <signal>clicked()</signal>
<receiver>DateBookWeekHeaderBase</receiver>
- <slot>weekChanged( int )</slot>
+ <slot>pickDate()</slot>
</connection>
@@ -161,2 +330,5 @@
<slot access="public">weekChanged( int )</slot>
+ <slot access="public">nextMonth()</slot>
+ <slot access="public">prevMonth()</slot>
+ <slot access="public">pickDate()</slot>
</connections>
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp
index e7c7208..5f555d5 100644
--- a/core/pim/datebook/datebookweekheaderimpl.cpp
+++ b/core/pim/datebook/datebookweekheaderimpl.cpp
@@ -20,2 +20,4 @@
#include "datebookweekheaderimpl.h"
+#include "datebookweekheader.h"
+#include "datebookweek.h"
#include <qlabel.h>
@@ -23,2 +25,6 @@
#include <qdatetime.h>
+#include <qpe/resource.h>
+#include <qpe/datebookmonth.h>
+
+#include <qtoolbutton.h>
@@ -35,2 +41,9 @@ DateBookWeekHeader::DateBookWeekHeader( bool startOnMonday, QWidget* parent,
labelDate->setBackgroundMode( PaletteButton );
+
+ backmonth->setPixmap( Resource::loadPixmap("fastback") );
+ backweek->setPixmap( Resource::loadPixmap("back") );
+ forwardweek->setPixmap( Resource::loadPixmap("forward") );
+ forwardmonth->setPixmap( Resource::loadPixmap("fastforward") );
+ spinYear->hide();
+ spinWeek->hide();
}
@@ -45,2 +58,20 @@ DateBookWeekHeader::~DateBookWeekHeader()
+void DateBookWeekHeader::pickDate()
+{
+ static QPopupMenu *m1 = 0;
+ static DateBookMonth *picker = 0;
+ QDate currDate = dateFromWeek( week, year, bStartOnMonday );
+ if ( !m1 ) {
+ m1 = new QPopupMenu( this );
+ picker = new DateBookMonth( m1, 0, TRUE );
+ m1->insertItem( picker );
+ connect( picker, SIGNAL( dateClicked( int, int, int ) ),
+ this, SLOT( setDate( int, int, int ) ) );
+// connect( m1, SIGNAL( aboutToHide() ),
+// this, SLOT( gotHide() ) );
+ }
+ picker->setDate( currDate.year(), currDate.month(), currDate.day() );
+ m1->popup(mapToGlobal(labelDate->pos()+QPoint(0,labelDate->height())));
+ picker->setFocus();
+}
/*
@@ -52,2 +83,14 @@ void DateBookWeekHeader::yearChanged( int y )
}
+void DateBookWeekHeader::nextMonth()
+{
+ QDate mydate = dateFromWeek( week, year, bStartOnMonday ); // Get current week
+ calcWeek( mydate.addDays(28), week, year, bStartOnMonday ); // Add 4 weeks.
+ setDate( year, week ); // update view
+}
+void DateBookWeekHeader::prevMonth()
+{
+ QDate mydate = dateFromWeek( week, year, bStartOnMonday ); // Get current week
+ calcWeek( mydate.addDays(-28), week, year, bStartOnMonday ); // Subtract 4 weeks
+ setDate( year, week ); // update view
+}
/*
@@ -57,4 +100,6 @@ void DateBookWeekHeader::nextWeek()
{
- if ( week < 52 )
- week++;
+ QDate mydate = dateFromWeek( week, year, bStartOnMonday ); // Get current week
+ calcWeek( mydate.addDays(7), week, year, bStartOnMonday); // Add 1 week
+// if ( week < 52 )
+// week++;
setDate( year, week );
@@ -66,4 +111,6 @@ void DateBookWeekHeader::prevWeek()
{
- if ( week > 1 )
- week--;
+ QDate mydate = dateFromWeek( week, year, bStartOnMonday ); // Get current week
+ calcWeek( mydate.addDays(-7), week, year, bStartOnMonday); // Add 1 week
+// if ( week > 1 )
+// week--;
setDate( year, week );
@@ -78,2 +125,8 @@ void DateBookWeekHeader::weekChanged( int w )
+void DateBookWeekHeader::setDate( int y, int m, int d )
+{
+ calcWeek( QDate(y,m,d), week, year, bStartOnMonday );
+ setDate( year, week );
+}
+
void DateBookWeekHeader::setDate( int y, int w )
@@ -91,3 +144,4 @@ void DateBookWeekHeader::setDate( int y, int w )
s += QString::number( d.day() ) + ". " + d.monthName( d.month() );
- labelDate->setText( s );
+ s += " ("+tr("week")+":"+QString::number( w )+")";
+ labelDate->setText( s );
diff --git a/core/pim/datebook/datebookweekheaderimpl.h b/core/pim/datebook/datebookweekheaderimpl.h
index 2abef46..2e5a6ca 100644
--- a/core/pim/datebook/datebookweekheaderimpl.h
+++ b/core/pim/datebook/datebookweekheaderimpl.h
@@ -41,6 +41,10 @@ signals:
public slots:
- void yearChanged( int );
- void nextWeek();
- void prevWeek();
- void weekChanged( int );
+ void pickDate();
+ void yearChanged( int );
+ void nextMonth();
+ void prevMonth();
+ void nextWeek();
+ void prevWeek();
+ void weekChanged( int );
+ void setDate( int y, int m, int d);