summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/mainwindow.cpp110
-rw-r--r--korganizer/mainwindow.h15
2 files changed, 86 insertions, 39 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;
74 74
75
75class KOex2phonePrefs : public QDialog 76class KOex2phonePrefs : public QDialog
@@ -146,6 +147,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
146 mFlagKeyPressed = false; 147 mFlagKeyPressed = false;
148 setCaption("KOrganizer/Pi");
147 KOPrefs *p = KOPrefs::instance(); 149 KOPrefs *p = KOPrefs::instance();
148 KPimGlobalPrefs::instance()->setGlobalConfig(); 150 KPimGlobalPrefs::instance()->setGlobalConfig();
149 if ( p->mHourSize > 18 ) 151 if ( p->mHourSize > 22 )
150 p->mHourSize = 18; 152 p->mHourSize = 22;
151 QMainWindow::ToolBarDock tbd; 153 QMainWindow::ToolBarDock tbd;
@@ -169,4 +171,2 @@ MainWindow::MainWindow( QWidget *parent, const char *name, QString msg) :
169 mCalendarModifiedFlag = false; 171 mCalendarModifiedFlag = false;
170
171 setCaption("KOrganizer/Pi");
172 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this ); 172 QLabel* splash = new QLabel(i18n("KO/Pi is starting ... "), this );
@@ -559,30 +559,41 @@ void MainWindow::initActions()
559 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) ); 559 connect ( selectFilterMenu, SIGNAL( aboutToShow() ), this, SLOT (fillFilterMenu() ) );
560 560 QIconSet icon;
561 menuBarWeek = new QPEMenuBar( iconToolBar ); 561 int pixWid = 22, pixHei = 22;
562 QPopupMenu * wpo = new QPopupMenu (this); 562 QString pathString = "";
563 QPopupMenu * all = new QPopupMenu (this); 563 if ( !p->mToolBarMiniIcons ) {
564 //wpo->insertItem( i18n("W#"), 0 ); 564 if ( QApplication::desktop()->width() < 480 ) {
565 int first = 1; 565 pathString += "icons16/";
566 int i; 566 pixWid = 18; pixHei = 16;
567 for ( i = 1; i < 50; ++i ) { 567 }
568 if ( !(i%10) ) { 568 } else {
569 all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); 569 pathString += "iconsmini/";
570 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); 570 pixWid = 18; pixHei = 16;
571 first = i; 571 }
572 wpo = new QPopupMenu (this); 572 mWeekBgColor = iconToolBar->backgroundColor();
573 } 573 mWeekPixmap.resize( pixWid , pixHei );
574 wpo->insertItem( QString::number(i), i ); 574 mWeekPixmap.fill( mWeekBgColor );
575 } 575 icon = mWeekPixmap;
576 for ( i = 50; i < 53; ++i ) { 576 mWeekAction = new QAction( i18n("Select week number"),icon, i18n("Select week number"), 0, this );
577 wpo->insertItem( QString::number(i), i); 577 mWeekAction->addTo( iconToolBar );
578 } 578 mWeekFont = font();
579 all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); 579
580 connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); 580 int fontPoint = mWeekFont.pointSize();
581 menuBarWeek->insertItem( "00",all,1); 581 QFontMetrics f( mWeekFont );
582 menuBarWeek->setMaximumSize( menuBarWeek->sizeHint( )); 582 int fontWid = f.width( "30" );
583 while ( fontWid > pixWid ) {
584 --fontPoint;
585 mWeekFont.setPointSize( fontPoint );
586 QFontMetrics f( mWeekFont );
587 fontWid = f.width( "30" );
588 qDebug("dec-- ");
589 }
590
591 connect( mWeekAction, SIGNAL( activated() ),
592 this, SLOT( weekAction() ) );
583 593
584 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) ); 594 connect( this, SIGNAL( selectWeek ( int ) ), mView->dateNavigator(), SLOT( selectWeek ( int ) ) );
595
596 //#endif
585 // ****************** 597 // ******************
586 QAction *action; 598 QAction *action;
587 QIconSet icon;
588 // QPopupMenu *configureMenu= new QPopupMenu( menuBar ); 599 // QPopupMenu *configureMenu= new QPopupMenu( menuBar );
@@ -590,8 +601,3 @@ void MainWindow::initActions()
590 601
591 QString pathString = ""; 602
592 if ( !p->mToolBarMiniIcons ) {
593 if ( QApplication::desktop()->width() < 480 )
594 pathString += "icons16/";
595 } else
596 pathString += "iconsmini/";
597 configureAgendaMenu->setCheckable( true ); 603 configureAgendaMenu->setCheckable( true );
@@ -1372,4 +1378,10 @@ void MainWindow::updateWeek(QDate seda)
1372 } 1378 }
1373 //qDebug("weeknum %s ", QString::number( weekNum).latin1()); 1379
1374 menuBarWeek-> changeItem(1, QString::number( weekNum) ); 1380 mWeekPixmap.fill( mWeekBgColor );
1381 QPainter p ( &mWeekPixmap );
1382 p.setFont( mWeekFont );
1383 p.drawText( 0,0,mWeekPixmap.width(), mWeekPixmap.height(),AlignCenter, QString::number( weekNum) );
1384 p.end();
1385 QIconSet icon3 ( mWeekPixmap );
1386 mWeekAction->setIconSet ( icon3 );
1375 1387
@@ -1721,3 +1733,3 @@ void MainWindow::keyPressEvent ( QKeyEvent * e )
1721 size = p->mHourSize +2; 1733 size = p->mHourSize +2;
1722 if ( size <= 18 ) 1734 if ( size <= 22 )
1723 configureAgenda( size ); 1735 configureAgenda( size );
@@ -2013 +2025,25 @@ void MainWindow::printCal()
2013 2025
2026
2027#include "libkdepim/kdatepicker.h"
2028#include <kdatetbl.h>
2029void MainWindow::weekAction()
2030{
2031 int month;
2032 KPopupFrame* popup = new KPopupFrame(this);
2033 int size = 12;
2034 if ( QApplication::desktop()->width() >= 480 )
2035 size = 18;
2036 KDateInternalWeekPicker* picker = new KDateInternalWeekPicker(size, popup);
2037 // -----
2038 picker->resize(picker->sizeHint());
2039 popup->setMainWidget(picker);
2040 picker->setFocus();
2041 connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
2042 if(popup->exec(iconToolBar->mapToGlobal(QPoint(0, iconToolBar->height()))))
2043 {
2044 month = picker->getResult();
2045 emit selectWeek ( month );
2046 //qDebug("weekSelected %d ", month);
2047 }
2048 delete popup;
2049}
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 @@
7#include <qfile.h> 7#include <qfile.h>
8#include <qmenubar.h>
8#include <qtextstream.h> 9#include <qtextstream.h>
@@ -25,3 +26,2 @@ class KSyncProfile;
25class QPEToolBar; 26class QPEToolBar;
26class QPEMenuBar;
27 27
@@ -32,2 +32,9 @@ class CalendarLocal;
32 32
33class KOMenuBar : public QMenuBar
34{
35 public:
36 KOMenuBar( QWidget *parent=0 ): QMenuBar (parent ) {;}
37 QSize sizeHint () const{ qDebug("sizejint ");return QSize ( 40,25 );}
38};
39
33using namespace KCal; 40using namespace KCal;
@@ -52,2 +59,3 @@ class MainWindow : public QMainWindow
52 void setCaptionToDates(); 59 void setCaptionToDates();
60 void weekAction();
53 void about(); 61 void about();
@@ -122,3 +130,6 @@ class MainWindow : public QMainWindow
122 QAction *mNewSubTodoAction; 130 QAction *mNewSubTodoAction;
123 QPEMenuBar *menuBarWeek; 131 QAction *mWeekAction;
132 QFont mWeekFont;
133 QPixmap mWeekPixmap;
134 QColor mWeekBgColor;
124 135