summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp106
-rw-r--r--korganizer/mainwindow.h15
2 files changed, 84 insertions, 37 deletions
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index 348dd5e..119e28a 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -74,2 +74,3 @@ using namespace KCal;
+
class KOex2phonePrefs : public QDialog
@@ -146,6 +147,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
mFlagKeyPressed = false;
+ setCaption("KOrganizer/Pi");
KOPrefs *p = KOPrefs::instance();
KPimGlobalPrefs::instance()->setGlobalConfig();
- if ( p->mHourSize > 18 )
- p->mHourSize = 18;
+ if ( p->mHourSize > 22 )
+ p->mHourSize = 22;
QMainWindow::ToolBarDock tbd;
@@ -169,4 +171,2 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
mCalendarModifiedFlag = false;
-
- setCaption("KOrganizer/Pi");
QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
@@ -559,30 +559,41 @@ void MainWindow::initActions()
connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
-
- menuBarWeek = new QPEMenuBar( iconToolBar );
- QPopupMenu * wpo = new QPopupMenu (this);
- QPopupMenu * all = new QPopupMenu (this);
- //wpo->insertItem( i18n("W#"), 0 );
- int first = 1;
- int i;
- for ( i = 1; i < 50; ++i ) {
- if ( !(i%10) ) {
- all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo );
- connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) );
- first = i;
- wpo = new QPopupMenu (this);
+ QIconSet icon;
+ int pixWid = 22, pixHei = 22;
+ QString pathString = "";
+ if ( !p->mToolBarMiniIcons ) {
+ if ( QApplication::desktop()->width() < 480 ) {
+ pathString += "icons16/";
+ pixWid = 18; pixHei = 16;
}
- wpo->insertItem( QString::number(i), i );
- }
- for ( i = 50; i < 53; ++i ) {
- wpo->insertItem( QString::number(i), i);
+ } else {
+ pathString += "iconsmini/";
+ pixWid = 18; pixHei = 16;
+ }
+ mWeekBgColor = iconToolBar->backgroundColor();
+ mWeekPixmap.resize( pixWid , pixHei );
+ mWeekPixmap.fill( mWeekBgColor );
+ icon = mWeekPixmap;
+ mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
+ mWeekAction->addTo( iconToolBar );
+ mWeekFont = font();
+
+ int fontPoint = mWeekFont.pointSize();
+ QFontMetrics f( mWeekFont );
+ int fontWid = f.width( "30" );
+ while ( fontWid > pixWid ) {
+ --fontPoint;
+ mWeekFont.setPointSize( fontPoint );
+ QFontMetrics f( mWeekFont );
+ fontWid = f.width( "30" );
+ qDebug("dec-- ");
}
- all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo );
- connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) );
- menuBarWeek->insertItem( "00",all,1);
- menuBarWeek->setMaximumSize( menuBarWeek->sizeHint( ));
+
+ connect( mWeekAction, SIGNAL( activated() ),
+ this, SLOT( weekAction() ) );
connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
+
+ //#endif
// ******************
QAction *action;
- QIconSet icon;
// QPopupMenu *configureMenu= new QPopupMenu( menuBar );
@@ -590,8 +601,3 @@ void MainWindow::initActions()
- QString pathString = "";
- if ( !p->mToolBarMiniIcons ) {
- if ( QApplication::desktop()->width() < 480 )
- pathString += "icons16/";
- } else
- pathString += "iconsmini/";
+
configureAgendaMenu->setCheckable( true );
@@ -1372,4 +1378,10 @@ void MainWindow::updateWeek(QDate seda)
}
- //qDebug("weeknum %s ", QString::number( weekNum).latin1());
- menuBarWeek-> changeItem(1, QString::number( weekNum) );
+
+ mWeekPixmap.fill( mWeekBgColor );
+ QPainter p ( &mWeekPixmap );
+ p.setFont( mWeekFont );
+ p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
+ p.end();
+ QIconSet icon3 ( mWeekPixmap );
+ mWeekAction->setIconSet ( icon3 );
@@ -1721,3 +1733,3 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
size = p->mHourSize +2;
- if ( size <= 18 )
+ if ( size <= 22 )
configureAgenda( size );
@@ -2013 +2025,25 @@ void MainWindow::printCal()
+
+#include "libkdepim/kdatepicker.h"
+#include <kdatetbl.h>
+void MainWindow::weekAction()
+{
+ int month;
+ KPopupFrame* popup = new KPopupFrame(this);
+ int size = 12;
+ if ( QApplication::desktop()->width() >= 480 )
+ size = 18;
+ KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(size, popup);
+ // -----
+ picker->resize(picker->sizeHint());
+ popup->setMainWidget(picker);
+ picker->setFocus();
+ connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
+ if(popup->exec(iconToolBar->mapToGlobal(QPoint(0, iconToolBar->height()))))
+ {
+ month = picker->getResult();
+ emit selectWeek ( month );
+ //qDebug("weekSelected %d ", month);
+ }
+ delete popup;
+}
diff --git a/korganizer/mainwindow.h b/korganizer/mainwindow.h
index 076ab94..5b9f903 100644
--- a/korganizer/mainwindow.h
+++ b/korganizer/mainwindow.h
@@ -7,2 +7,3 @@
#include <qfile.h>
+#include <qmenubar.h>
#include <qtextstream.h>
@@ -25,3 +26,2 @@ class KSyncProfile;
class QPEToolBar;
-class QPEMenuBar;
@@ -32,2 +32,9 @@ class CalendarLocal;
+class KOMenuBar : public QMenuBar
+{
+ public:
+ KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;}
+ QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );}
+};
+
using namespace KCal;
@@ -52,2 +59,3 @@ class MainWindow : public QMainWindow
void setCaptionToDates();
+ void weekAction();
void about();
@@ -122,3 +130,6 @@ class MainWindow : public QMainWindow
QAction *mNewSubTodoAction;
- QPEMenuBar *menuBarWeek;
+ QAction *mWeekAction;
+ QFont mWeekFont;
+ QPixmap mWeekPixmap;
+ QColor mWeekBgColor;