-rw-r--r-- | korganizer/navigatorbar.cpp | 12 | ||||
-rw-r--r-- | microkde/kdatetbl.cpp | 4 |
2 files changed, 5 insertions, 11 deletions
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 7ba97c8..b591232 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp | |||
@@ -17,105 +17,99 @@ | |||
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 | 19 | ||
20 | As a special exception, permission is given to link this program | 20 | As a special exception, permission is given to link this program |
21 | with any edition of Qt, and distribute the resulting executable, | 21 | with any edition of Qt, and distribute the resulting executable, |
22 | without including the source code for Qt in the source distribution. | 22 | without including the source code for Qt in the source distribution. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qtooltip.h> | 26 | #include <qtooltip.h> |
27 | #include <qpushbutton.h> | 27 | #include <qpushbutton.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qframe.h> | 29 | #include <qframe.h> |
30 | #include <qlabel.h> | 30 | #include <qlabel.h> |
31 | #include <qpopupmenu.h> | 31 | #include <qpopupmenu.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | 33 | ||
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <klocale.h> | 35 | #include <klocale.h> |
36 | #include <kglobal.h> | 36 | #include <kglobal.h> |
37 | #include <kiconloader.h> | 37 | #include <kiconloader.h> |
38 | #include "libkdepim/kdatepicker.h" | 38 | #include "libkdepim/kdatepicker.h" |
39 | #include <knotifyclient.h> | 39 | #include <knotifyclient.h> |
40 | #include "kdatetbl.h" | 40 | #include "kdatetbl.h" |
41 | 41 | ||
42 | #include "koglobals.h" | 42 | #include "koglobals.h" |
43 | #include <kglobalsettings.h> | 43 | #include <kglobalsettings.h> |
44 | #include "koprefs.h" | 44 | #include "koprefs.h" |
45 | #ifndef KORG_NOPLUGINS | 45 | #ifndef KORG_NOPLUGINS |
46 | #include "kocore.h" | 46 | #include "kocore.h" |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | #include <kcalendarsystem.h> | 49 | #include <kcalendarsystem.h> |
50 | 50 | ||
51 | #include "navigatorbar.h" | 51 | #include "navigatorbar.h" |
52 | 52 | ||
53 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) | 53 | NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *name ) |
54 | : QWidget( parent, name ) | 54 | : QWidget( parent, name ) |
55 | { | 55 | { |
56 | QBoxLayout *topLayout = new QHBoxLayout( this ); | 56 | QBoxLayout *topLayout = new QHBoxLayout( this ); |
57 | 57 | ||
58 | // Set up the control buttons and date label | 58 | // Set up the control buttons and date label |
59 | mCtrlFrame = new QFrame( this ); | 59 | mCtrlFrame = new QFrame( this ); |
60 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); | 60 | mCtrlFrame->setFrameStyle(QFrame::Panel|QFrame::Raised); |
61 | mCtrlFrame->setLineWidth(1); | 61 | mCtrlFrame->setLineWidth(1); |
62 | 62 | ||
63 | topLayout->addWidget( mCtrlFrame ); | 63 | topLayout->addWidget( mCtrlFrame ); |
64 | 64 | ||
65 | QFont tfont = KGlobalSettings::generalFont();//font(); | 65 | QFont tfont = font(); |
66 | int add = 0; | 66 | if ( QApplication::desktop()->width() >= 480 ) |
67 | if ( QApplication::desktop()->width() >= 480 ) { | 67 | tfont.setPointSize(tfont.pointSize()+2); |
68 | add = 2; | ||
69 | if ( QString ( name ) == QString("useBigPixmaps") ) | ||
70 | add += 2; | ||
71 | } | ||
72 | if ( add ) | ||
73 | tfont.setPointSize(tfont.pointSize()+add); | ||
74 | tfont.setBold(true); | 68 | tfont.setBold(true); |
75 | 69 | ||
76 | bool isRTL = KOGlobals::self()->reverseLayout(); | 70 | bool isRTL = KOGlobals::self()->reverseLayout(); |
77 | #ifndef DESKTOP_VERSION | 71 | #ifndef DESKTOP_VERSION |
78 | bool isDesktop = false; | 72 | bool isDesktop = false; |
79 | #else | 73 | #else |
80 | bool isDesktop = true; | 74 | bool isDesktop = true; |
81 | #endif | 75 | #endif |
82 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) | 76 | if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) |
83 | isDesktop = true; | 77 | isDesktop = true; |
84 | // Create backward navigation buttons | 78 | // Create backward navigation buttons |
85 | mPrevYear = new QPushButton( mCtrlFrame ); | 79 | mPrevYear = new QPushButton( mCtrlFrame ); |
86 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); | 80 | mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); |
87 | QToolTip::add( mPrevYear, i18n("Previous Year") ); | 81 | QToolTip::add( mPrevYear, i18n("Previous Year") ); |
88 | 82 | ||
89 | mPrevMonth = new QPushButton( mCtrlFrame ); | 83 | mPrevMonth = new QPushButton( mCtrlFrame ); |
90 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); | 84 | mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); |
91 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); | 85 | QToolTip::add( mPrevMonth, i18n("Previous Month") ); |
92 | 86 | ||
93 | // Create forward navigation buttons | 87 | // Create forward navigation buttons |
94 | mNextMonth = new QPushButton( mCtrlFrame ); | 88 | mNextMonth = new QPushButton( mCtrlFrame ); |
95 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); | 89 | mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); |
96 | QToolTip::add( mNextMonth, i18n("Next Month") ); | 90 | QToolTip::add( mNextMonth, i18n("Next Month") ); |
97 | 91 | ||
98 | mNextYear = new QPushButton( mCtrlFrame ); | 92 | mNextYear = new QPushButton( mCtrlFrame ); |
99 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); | 93 | mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); |
100 | QToolTip::add( mNextYear, i18n("Next Year") ); | 94 | QToolTip::add( mNextYear, i18n("Next Year") ); |
101 | mSelectMonth = new QPushButton( mCtrlFrame ); | 95 | mSelectMonth = new QPushButton( mCtrlFrame ); |
102 | // Create month name label | 96 | // Create month name label |
103 | //selectMonth->setFont( tfont ); | 97 | //selectMonth->setFont( tfont ); |
104 | // selectMonth->setAlignment( AlignCenter ); | 98 | // selectMonth->setAlignment( AlignCenter ); |
105 | //mDateLabel = new QLabel( selectMonth ); | 99 | //mDateLabel = new QLabel( selectMonth ); |
106 | //mDateLabel->setFont( tfont ); | 100 | //mDateLabel->setFont( tfont ); |
107 | //mDateLabel->setAlignment( AlignCenter ); | 101 | //mDateLabel->setAlignment( AlignCenter ); |
108 | if ( QString ( name ) == QString("useBigPixmaps") ) { | 102 | if ( QString ( name ) == QString("useBigPixmaps") ) { |
109 | mNextMonth->setFlat( true); | 103 | mNextMonth->setFlat( true); |
110 | mNextYear->setFlat( true); | 104 | mNextYear->setFlat( true); |
111 | mSelectMonth->setFlat( true); | 105 | mSelectMonth->setFlat( true); |
112 | mPrevYear->setFlat( true); | 106 | mPrevYear->setFlat( true); |
113 | mPrevMonth->setFlat( true); | 107 | mPrevMonth->setFlat( true); |
114 | } | 108 | } |
115 | mSelectMonth->setFont( tfont ); | 109 | mSelectMonth->setFont( tfont ); |
116 | // Set minimum width to width of widest month name label | 110 | // Set minimum width to width of widest month name label |
117 | int i; | 111 | int i; |
118 | int maxwidth = 0; | 112 | int maxwidth = 0; |
119 | QFontMetrics fm ( mSelectMonth->font() ); | 113 | QFontMetrics fm ( mSelectMonth->font() ); |
120 | int width = fm.width("September '00" ); | 114 | int width = fm.width("September '00" ); |
121 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); | 115 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); |
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp index 990cfb9..a9924ba 100644 --- a/microkde/kdatetbl.cpp +++ b/microkde/kdatetbl.cpp | |||
@@ -411,97 +411,97 @@ KDateTable::setDate(const QDate& date_) | |||
411 | emit(dateChanged(date)); | 411 | emit(dateChanged(date)); |
412 | return true; | 412 | return true; |
413 | } | 413 | } |
414 | 414 | ||
415 | const QDate& | 415 | const QDate& |
416 | KDateTable::getDate() const | 416 | KDateTable::getDate() const |
417 | { | 417 | { |
418 | return date; | 418 | return date; |
419 | } | 419 | } |
420 | 420 | ||
421 | void KDateTable::focusInEvent( QFocusEvent *e ) | 421 | void KDateTable::focusInEvent( QFocusEvent *e ) |
422 | { | 422 | { |
423 | repaintContents(false); | 423 | repaintContents(false); |
424 | QGridView::focusInEvent( e ); | 424 | QGridView::focusInEvent( e ); |
425 | } | 425 | } |
426 | 426 | ||
427 | void KDateTable::focusOutEvent( QFocusEvent *e ) | 427 | void KDateTable::focusOutEvent( QFocusEvent *e ) |
428 | { | 428 | { |
429 | repaintContents(false); | 429 | repaintContents(false); |
430 | QGridView::focusOutEvent( e ); | 430 | QGridView::focusOutEvent( e ); |
431 | } | 431 | } |
432 | 432 | ||
433 | QSize | 433 | QSize |
434 | KDateTable::sizeHint() const | 434 | KDateTable::sizeHint() const |
435 | { | 435 | { |
436 | if(maxCell.height()>0 && maxCell.width()>0) | 436 | if(maxCell.height()>0 && maxCell.width()>0) |
437 | { | 437 | { |
438 | return QSize((maxCell.width()+2)*numCols()+2*frameWidth(), | 438 | return QSize((maxCell.width()+2)*numCols()+2*frameWidth(), |
439 | (maxCell.height()+4)*numRows()+2*frameWidth()); | 439 | (maxCell.height()+4)*numRows()+2*frameWidth()); |
440 | } else { | 440 | } else { |
441 | return QSize(-1, -1); | 441 | return QSize(-1, -1); |
442 | } | 442 | } |
443 | } | 443 | } |
444 | 444 | ||
445 | KDateInternalMonthPicker::KDateInternalMonthPicker | 445 | KDateInternalMonthPicker::KDateInternalMonthPicker |
446 | (QWidget* parent, const char* name) | 446 | (QWidget* parent, const char* name) |
447 | : QGridView(parent, name), | 447 | : QGridView(parent, name), |
448 | result(0) // invalid | 448 | result(0) // invalid |
449 | { | 449 | { |
450 | QRect rect; | 450 | QRect rect; |
451 | QFont font; | 451 | QFont font; |
452 | // ----- | 452 | // ----- |
453 | activeCol = -1; | 453 | activeCol = -1; |
454 | activeRow = -1; | 454 | activeRow = -1; |
455 | font=KGlobalSettings::generalFont(); | 455 | font=KGlobalSettings::generalFont(); |
456 | int fontsize = 10; | 456 | int fontsize = 10; |
457 | int add = 2; | 457 | int add = 2; |
458 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 458 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
459 | add += 6; | 459 | add += 8; |
460 | font.setPointSize(fontsize+add); | 460 | font.setPointSize(fontsize+add); |
461 | setFont(font); | 461 | setFont(font); |
462 | setHScrollBarMode(AlwaysOff); | 462 | setHScrollBarMode(AlwaysOff); |
463 | setVScrollBarMode(AlwaysOff); | 463 | setVScrollBarMode(AlwaysOff); |
464 | setFrameStyle(QFrame::NoFrame); | 464 | setFrameStyle(QFrame::NoFrame); |
465 | setNumRows(4); | 465 | setNumRows(4); |
466 | setNumCols(3); | 466 | setNumCols(3); |
467 | // enable to find drawing failures: | 467 | // enable to find drawing failures: |
468 | // setTableFlags(Tbl_clipCellPainting); | 468 | // setTableFlags(Tbl_clipCellPainting); |
469 | #if 0 | 469 | #if 0 |
470 | viewport()->setEraseColor(lightGray); // for consistency with the datepicker | 470 | viewport()->setEraseColor(lightGray); // for consistency with the datepicker |
471 | #endif | 471 | #endif |
472 | // ----- find the preferred size | 472 | // ----- find the preferred size |
473 | // (this is slow, possibly, but unfortunatly it is needed here): | 473 | // (this is slow, possibly, but unfortunatly it is needed here): |
474 | QFontMetrics metrics(font); | 474 | QFontMetrics metrics(font); |
475 | for(int i=1; i <= 12; ++i) | 475 | for(int i=1; i <= 12; ++i) |
476 | { | 476 | { |
477 | rect=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); | 477 | rect=metrics.boundingRect(KGlobal::locale()->monthName(i, false)); |
478 | if(max.width()<rect.width()) max.setWidth(rect.width()); | 478 | if(max.width()<rect.width()) max.setWidth(rect.width()); |
479 | if(max.height()<rect.height()) max.setHeight(rect.height()); | 479 | if(max.height()<rect.height()) max.setHeight(rect.height()); |
480 | } | 480 | } |
481 | 481 | ||
482 | } | 482 | } |
483 | 483 | ||
484 | QSize | 484 | QSize |
485 | KDateInternalMonthPicker::sizeHint() const | 485 | KDateInternalMonthPicker::sizeHint() const |
486 | { | 486 | { |
487 | return QSize((max.width()+6)*numCols()+2*frameWidth(), | 487 | return QSize((max.width()+6)*numCols()+2*frameWidth(), |
488 | (max.height()+6)*numRows()+2*frameWidth()); | 488 | (max.height()+6)*numRows()+2*frameWidth()); |
489 | } | 489 | } |
490 | 490 | ||
491 | int | 491 | int |
492 | KDateInternalMonthPicker::getResult() const | 492 | KDateInternalMonthPicker::getResult() const |
493 | { | 493 | { |
494 | return result; | 494 | return result; |
495 | } | 495 | } |
496 | 496 | ||
497 | void | 497 | void |
498 | KDateInternalMonthPicker::setupPainter(QPainter *p) | 498 | KDateInternalMonthPicker::setupPainter(QPainter *p) |
499 | { | 499 | { |
500 | p->setPen(black); | 500 | p->setPen(black); |
501 | } | 501 | } |
502 | 502 | ||
503 | void | 503 | void |
504 | KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*) | 504 | KDateInternalMonthPicker::viewportResizeEvent(QResizeEvent*) |
505 | { | 505 | { |
506 | setCellWidth(width()/3); | 506 | setCellWidth(width()/3); |
507 | setCellHeight(height()/4); | 507 | setCellHeight(height()/4); |
@@ -733,97 +733,97 @@ KPopupFrame::popup(const QPoint &pos) | |||
733 | x = 0; | 733 | x = 0; |
734 | if (y < d.y()) | 734 | if (y < d.y()) |
735 | y = 0; | 735 | y = 0; |
736 | 736 | ||
737 | // Pop the thingy up. | 737 | // Pop the thingy up. |
738 | move(x, y); | 738 | move(x, y); |
739 | show(); | 739 | show(); |
740 | } | 740 | } |
741 | 741 | ||
742 | int | 742 | int |
743 | KPopupFrame::exec(QPoint pos) | 743 | KPopupFrame::exec(QPoint pos) |
744 | { | 744 | { |
745 | popup(pos); | 745 | popup(pos); |
746 | repaint(); | 746 | repaint(); |
747 | qApp->enter_loop(); | 747 | qApp->enter_loop(); |
748 | hide(); | 748 | hide(); |
749 | return result; | 749 | return result; |
750 | } | 750 | } |
751 | 751 | ||
752 | int | 752 | int |
753 | KPopupFrame::exec(int x, int y) | 753 | KPopupFrame::exec(int x, int y) |
754 | { | 754 | { |
755 | return exec(QPoint(x, y)); | 755 | return exec(QPoint(x, y)); |
756 | } | 756 | } |
757 | 757 | ||
758 | void KPopupFrame::virtual_hook( int, void* ) | 758 | void KPopupFrame::virtual_hook( int, void* ) |
759 | { /*BASE::virtual_hook( id, data );*/ } | 759 | { /*BASE::virtual_hook( id, data );*/ } |
760 | 760 | ||
761 | void KDateTable::virtual_hook( int, void* ) | 761 | void KDateTable::virtual_hook( int, void* ) |
762 | { /*BASE::virtual_hook( id, data );*/ } | 762 | { /*BASE::virtual_hook( id, data );*/ } |
763 | 763 | ||
764 | //#include "kdatetbl.moc" | 764 | //#include "kdatetbl.moc" |
765 | 765 | ||
766 | 766 | ||
767 | KDateInternalWeekPicker::KDateInternalWeekPicker | 767 | KDateInternalWeekPicker::KDateInternalWeekPicker |
768 | (QWidget* parent, const char* name) | 768 | (QWidget* parent, const char* name) |
769 | : QGridView(parent, name), | 769 | : QGridView(parent, name), |
770 | result(0) // invalid | 770 | result(0) // invalid |
771 | { | 771 | { |
772 | QRect rect; | 772 | QRect rect; |
773 | QFont font; | 773 | QFont font; |
774 | // ----- | 774 | // ----- |
775 | activeCol = -1; | 775 | activeCol = -1; |
776 | activeRow = -1; | 776 | activeRow = -1; |
777 | font=KGlobalSettings::generalFont(); | 777 | font=KGlobalSettings::generalFont(); |
778 | int fontsize = 10; | 778 | int fontsize = 10; |
779 | int add = 2; | 779 | int add = 2; |
780 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 780 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
781 | add += 4; | 781 | add += 6; |
782 | font.setPointSize(fontsize+add); | 782 | font.setPointSize(fontsize+add); |
783 | setFont(font); | 783 | setFont(font); |
784 | setHScrollBarMode(AlwaysOff); | 784 | setHScrollBarMode(AlwaysOff); |
785 | setVScrollBarMode(AlwaysOff); | 785 | setVScrollBarMode(AlwaysOff); |
786 | setFrameStyle(QFrame::NoFrame); | 786 | setFrameStyle(QFrame::NoFrame); |
787 | setNumRows(13); | 787 | setNumRows(13); |
788 | setNumCols(4); | 788 | setNumCols(4); |
789 | // enable to find drawing failures: | 789 | // enable to find drawing failures: |
790 | // setTableFlags(Tbl_clipCellPainting); | 790 | // setTableFlags(Tbl_clipCellPainting); |
791 | #if 0 | 791 | #if 0 |
792 | viewport()->setEraseColor(lightGray); // for consistency with the datepicker | 792 | viewport()->setEraseColor(lightGray); // for consistency with the datepicker |
793 | #endif | 793 | #endif |
794 | // ----- find the preferred size | 794 | // ----- find the preferred size |
795 | // (this is slow, possibly, but unfortunatly it is needed here): | 795 | // (this is slow, possibly, but unfortunatly it is needed here): |
796 | QFontMetrics metrics(font); | 796 | QFontMetrics metrics(font); |
797 | for(int i=1; i <= 52; ++i) | 797 | for(int i=1; i <= 52; ++i) |
798 | { | 798 | { |
799 | rect=metrics.boundingRect(QString::number( i )); | 799 | rect=metrics.boundingRect(QString::number( i )); |
800 | if(max.width()<rect.width()) max.setWidth(rect.width()); | 800 | if(max.width()<rect.width()) max.setWidth(rect.width()); |
801 | if(max.height()<rect.height()) max.setHeight(rect.height()); | 801 | if(max.height()<rect.height()) max.setHeight(rect.height()); |
802 | } | 802 | } |
803 | if ( QApplication::desktop()->width() > 640 ) { | 803 | if ( QApplication::desktop()->width() > 640 ) { |
804 | 804 | ||
805 | max.setWidth(max.width()+6); | 805 | max.setWidth(max.width()+6); |
806 | max.setHeight(max.height()+8); | 806 | max.setHeight(max.height()+8); |
807 | } | 807 | } |
808 | } | 808 | } |
809 | 809 | ||
810 | QSize | 810 | QSize |
811 | KDateInternalWeekPicker::sizeHint() const | 811 | KDateInternalWeekPicker::sizeHint() const |
812 | { | 812 | { |
813 | return QSize((max.width()+6)*numCols()+2*frameWidth(), | 813 | return QSize((max.width()+6)*numCols()+2*frameWidth(), |
814 | (max.height()+6)*numRows()+2*frameWidth()); | 814 | (max.height()+6)*numRows()+2*frameWidth()); |
815 | } | 815 | } |
816 | 816 | ||
817 | int | 817 | int |
818 | KDateInternalWeekPicker::getResult() const | 818 | KDateInternalWeekPicker::getResult() const |
819 | { | 819 | { |
820 | return result; | 820 | return result; |
821 | } | 821 | } |
822 | 822 | ||
823 | void | 823 | void |
824 | KDateInternalWeekPicker::setupPainter(QPainter *p) | 824 | KDateInternalWeekPicker::setupPainter(QPainter *p) |
825 | { | 825 | { |
826 | p->setPen(black); | 826 | p->setPen(black); |
827 | } | 827 | } |
828 | 828 | ||
829 | void | 829 | void |