summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-01-26 04:09:44 (UTC)
committer zautrix <zautrix>2005-01-26 04:09:44 (UTC)
commitc3e40c9baa61009469022a87e9cd068734899bcc (patch) (unidiff)
tree11f0f33d939fd17f613381fec4cf8c454b9847b4 /korganizer
parent76b0e73d8752448058e2fa3ad065f0219b9ffad8 (diff)
downloadkdepimpi-c3e40c9baa61009469022a87e9cd068734899bcc.zip
kdepimpi-c3e40c9baa61009469022a87e9cd068734899bcc.tar.gz
kdepimpi-c3e40c9baa61009469022a87e9cd068734899bcc.tar.bz2
monthview fix
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp8
-rw-r--r--korganizer/koprefs.cpp2
2 files changed, 7 insertions, 3 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index b819eec..437debe 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -40,71 +40,72 @@
40#include <kiconloader.h> 40#include <kiconloader.h>
41 41
42#include <kcalendarsystem.h> 42#include <kcalendarsystem.h>
43 43
44#ifndef KORG_NOPRINTER 44#ifndef KORG_NOPRINTER
45#include "calprinter.h" 45#include "calprinter.h"
46#endif 46#endif
47#include "koprefs.h" 47#include "koprefs.h"
48#ifndef KORG_NOPLUGINS 48#ifndef KORG_NOPLUGINS
49#include "kocore.h" 49#include "kocore.h"
50#endif 50#endif
51#include "koglobals.h" 51#include "koglobals.h"
52#include <libkcal/kincidenceformatter.h> 52#include <libkcal/kincidenceformatter.h>
53 53
54#include "komonthview.h" 54#include "komonthview.h"
55 55
56#define PIXMAP_SIZE 5 56#define PIXMAP_SIZE 5
57#ifdef DESKTOP_VERSION 57#ifdef DESKTOP_VERSION
58 QToolTipGroup *MonthViewCell::mToolTipGroup = 0; 58 QToolTipGroup *MonthViewCell::mToolTipGroup = 0;
59#endif 59#endif
60class KNOWhatsThis :public QWhatsThis 60class KNOWhatsThis :public QWhatsThis
61{ 61{
62public: 62public:
63 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { }; 63 KNOWhatsThis( KNoScrollListBox* sbox ) : QWhatsThis( sbox ), _wid( sbox) { };
64 //~KNOWhatsThis( ) {qDebug("~KNOWhatsThis( ) "); };
64 65
65protected: 66protected:
66 virtual QString text( const QPoint& p) 67 virtual QString text( const QPoint& p)
67 { 68 {
68 return _wid->getWhatsThisText(p) ; 69 return _wid->getWhatsThisText(p) ;
69 }; 70 };
70private: 71private:
71 KNoScrollListBox* _wid; 72 KNoScrollListBox* _wid;
72 73
73}; 74};
74 75
75 76
76KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name) 77KNoScrollListBox::KNoScrollListBox(QWidget *parent,const char *name)
77 : QListBox(parent, name, WRepaintNoErase) 78 : QListBox(parent, name, WRepaintNoErase)
78{ 79{
79#ifndef DESKTOP_VERSION 80#ifndef DESKTOP_VERSION
80 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 81 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
81#endif 82#endif
82 mWT = new KNOWhatsThis(this); 83 mWT = new KNOWhatsThis(this);
83} 84}
84KNoScrollListBox::~KNoScrollListBox() 85KNoScrollListBox::~KNoScrollListBox()
85{ 86{
86 delete mWT; 87
87} 88}
88QString KNoScrollListBox::getWhatsThisText(QPoint p) 89QString KNoScrollListBox::getWhatsThisText(QPoint p)
89{ 90{
90 QListBoxItem* item = itemAt ( p ); 91 QListBoxItem* item = itemAt ( p );
91 if ( ! item ) { 92 if ( ! item ) {
92 return i18n("Click in the cell\nto add an event!"); 93 return i18n("Click in the cell\nto add an event!");
93 } 94 }
94 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence()); 95 return KIncidenceFormatter::instance()->getFormattedText(((MonthViewItem*) item)->incidence());
95} 96}
96void KNoScrollListBox::keyPressEvent(QKeyEvent *e) 97void KNoScrollListBox::keyPressEvent(QKeyEvent *e)
97{ 98{
98 99
99 switch(e->key()) { 100 switch(e->key()) {
100 case Key_Right: 101 case Key_Right:
101 // if ( e->state() == Qt::ControlButton ) 102 // if ( e->state() == Qt::ControlButton )
102 { 103 {
103 e->ignore(); 104 e->ignore();
104 return; 105 return;
105 } 106 }
106 scrollBy(4,0); 107 scrollBy(4,0);
107 break; 108 break;
108 case Key_Left: 109 case Key_Left:
109 // if ( e->state() == Qt::ControlButton ) 110 // if ( e->state() == Qt::ControlButton )
110 { 111 {
@@ -638,51 +639,53 @@ QDate MonthViewCell::selectedIncidenceDate()
638 639
639 MonthViewItem *item = 640 MonthViewItem *item =
640 static_cast<MonthViewItem *>( mItemList->item( index ) ); 641 static_cast<MonthViewItem *>( mItemList->item( index ) );
641 642
642 if ( !item ) return qd; 643 if ( !item ) return qd;
643 644
644 return item->incidenceDate(); 645 return item->incidenceDate();
645} 646}
646 647
647void MonthViewCell::deselect() 648void MonthViewCell::deselect()
648{ 649{
649 mItemList->clearSelection(); 650 mItemList->clearSelection();
650 enableScrollBars( false ); 651 enableScrollBars( false );
651 // updateCell(); 652 // updateCell();
652} 653}
653void MonthViewCell::select() 654void MonthViewCell::select()
654{ 655{
655 ;// updateCell(); 656 ;// updateCell();
656} 657}
657 658
658void MonthViewCell::resizeEvent ( QResizeEvent * ) 659void MonthViewCell::resizeEvent ( QResizeEvent * )
659{ 660{
660 if ( !mMonthView->isUpdatePossible() ) 661 if ( !mMonthView->isUpdatePossible() )
661 return; 662 return;
663#ifndef DESKTOP_VERSION
662 if ( !isVisible() ){ 664 if ( !isVisible() ){
663 return; 665 return;
664 } 666 }
667#endif
665 int size = height() - mLabel->height(); 668 int size = height() - mLabel->height();
666 if ( size > 0 ) 669 if ( size > 0 )
667 mItemList->verticalScrollBar()->setMaximumHeight( size ); 670 mItemList->verticalScrollBar()->setMaximumHeight( size );
668 size = width() - mLabel->width(); 671 size = width() - mLabel->width();
669 if ( size > 0 ) 672 if ( size > 0 )
670 mItemList->horizontalScrollBar()->setMaximumWidth( size ); 673 mItemList->horizontalScrollBar()->setMaximumWidth( size );
671 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() ); 674 mLabel->move( width()-mItemList->lineWidth() - mLabel->width(), height()-mItemList->lineWidth() - mLabel->height() );
672 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 675 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
673} 676}
674 677
675void MonthViewCell::defaultAction( QListBoxItem *item ) 678void MonthViewCell::defaultAction( QListBoxItem *item )
676{ 679{
677 if ( !item ) return; 680 if ( !item ) return;
678 681
679 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 682 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
680 Incidence *incidence = eventItem->incidence(); 683 Incidence *incidence = eventItem->incidence();
681 if ( incidence ) mMonthView->defaultAction( incidence ); 684 if ( incidence ) mMonthView->defaultAction( incidence );
682} 685}
683void MonthViewCell::showDay() 686void MonthViewCell::showDay()
684{ 687{
685 emit showDaySignal( date() ); 688 emit showDaySignal( date() );
686} 689}
687void MonthViewCell::newEvent() 690void MonthViewCell::newEvent()
688{ 691{
@@ -716,49 +719,50 @@ void MonthViewCell::contextMenu( QListBoxItem *item )
716 719
717 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 720 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
718 Incidence *incidence = eventItem->incidence(); 721 Incidence *incidence = eventItem->incidence();
719 if ( incidence ) mMonthView->showContextMenu( incidence ); 722 if ( incidence ) mMonthView->showContextMenu( incidence );
720} 723}
721 724
722void MonthViewCell::selection( QListBoxItem *item ) 725void MonthViewCell::selection( QListBoxItem *item )
723{ 726{
724 if ( !item ) return; 727 if ( !item ) return;
725 728
726 mMonthView->setSelectedCell( this ); 729 mMonthView->setSelectedCell( this );
727} 730}
728 731
729 732
730// ******************************************************************************* 733// *******************************************************************************
731// ******************************************************************************* 734// *******************************************************************************
732// ******************************************************************************* 735// *******************************************************************************
733 736
734 737
735KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) 738KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
736 : KOEventView( calendar, parent, name ), 739 : KOEventView( calendar, parent, name ),
737 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), 740 mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ),
738 mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) 741 mShortDayLabels( false ), mWidthLongDayLabel( 0 ), mSelectedCell( 0 )
739{ 742{
740 updatePossible = false; 743
744 updatePossible = false;
741 mCells.setAutoDelete( true ); 745 mCells.setAutoDelete( true );
742 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ; 746 mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ;
743 // mDayLayout = new QGridLayout( this ); 747 // mDayLayout = new QGridLayout( this );
744 // create the day of the week labels (Sun, Mon, etc) and add them to 748 // create the day of the week labels (Sun, Mon, etc) and add them to
745 // the layout. 749 // the layout.
746 mDayLabels.resize( mDaysPerWeek ); 750 mDayLabels.resize( mDaysPerWeek );
747 QFont bfont = font(); 751 QFont bfont = font();
748 if ( QApplication::desktop()->width() < 650 ) { 752 if ( QApplication::desktop()->width() < 650 ) {
749 bfont.setPointSize( bfont.pointSize() - 2 ); 753 bfont.setPointSize( bfont.pointSize() - 2 );
750 } 754 }
751 bfont.setBold( true ); 755 bfont.setBold( true );
752 int i; 756 int i;
753 757
754 for( i = 0; i < mDaysPerWeek; i++ ) { 758 for( i = 0; i < mDaysPerWeek; i++ ) {
755 QLabel *label = new QLabel( this ); 759 QLabel *label = new QLabel( this );
756 label->setFont(bfont); 760 label->setFont(bfont);
757 label->setFrameStyle(QFrame::Panel|QFrame::Raised); 761 label->setFrameStyle(QFrame::Panel|QFrame::Raised);
758 label->setLineWidth(1); 762 label->setLineWidth(1);
759 label->setAlignment(AlignCenter); 763 label->setAlignment(AlignCenter);
760 mDayLabels.insert( i, label ); 764 mDayLabels.insert( i, label );
761 } 765 }
762 766
763 bfont.setBold( false ); 767 bfont.setBold( false );
764 mWeekLabels.resize( mNumWeeks+1 ); 768 mWeekLabels.resize( mNumWeeks+1 );
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index dbbe832..ddd9cf8 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -207,49 +207,49 @@ KOPrefs::KOPrefs() :
207 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true); 207 addItemBool("MonthViewUsesDayColors",&mMonthViewUsesDayColors,true);
208 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true); 208 addItemBool("MonthViewSatSunTog",&mMonthViewSatSunTog,true);
209 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false); 209 addItemBool("HightlightDateTimeEdit",&mHightlightDateTimeEdit,false);
210 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 )); 210 addItemColor("AppColor1",&mAppColor1,QColor( 130,170,255 ));
211 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 )); 211 addItemColor("AppColor2",&mAppColor2,QColor( 174,216,255 ));
212 addItemBool("UseAppColors",&mUseAppColors,false); 212 addItemBool("UseAppColors",&mUseAppColors,false);
213 213
214 214
215 215
216 KPrefs::setCurrentGroup("Views"); 216 KPrefs::setCurrentGroup("Views");
217 addItemBool("Show Date Navigator",&mShowDateNavigator,true); 217 addItemBool("Show Date Navigator",&mShowDateNavigator,true);
218 addItemInt("Hour Size",&mHourSize,8); 218 addItemInt("Hour Size",&mHourSize,8);
219 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 219 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
220 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 220 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
221 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 221 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
222 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 222 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
223 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 223 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
224 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 224 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
225 addItemBool("Enable ToolTips",&mEnableToolTips,false); 225 addItemBool("Enable ToolTips",&mEnableToolTips,false);
226 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 226 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
227 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false); 227 addItemBool("Marcus Bains shows seconds",&mMarcusBainsShowSeconds,false);
228 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true); 228 addItemBool("Show Marcus Bains",&mMarcusBainsEnabled,true);
229 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true); 229 addItemBool("EditOnDoubleClick",&mEditOnDoubleClick,true);
230 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true); 230 addItemBool("ViewChangeHoldFullscreen",&mViewChangeHoldFullscreen,true);
231 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,true); 231 addItemBool("ViewChangeHoldNonFullscreen",&mViewChangeHoldNonFullscreen,false);
232 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false); 232 addItemBool("CenterOnCurrentTime",&mCenterOnCurrentTime,false);
233 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true); 233 addItemBool("SetTimeToDayStartAt",&mSetTimeToDayStartAt,true);
234 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true); 234 addItemBool("HighlightCurrentDay",&mHighlightCurrentDay,true);
235 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);; 235 addItemBool("WNViewShowsParents",&mWNViewShowsParents,true);;
236 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true); 236 addItemBool("WNViewShowsPast",&mWNViewShowsPast,true);
237 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false); 237 addItemBool("WNViewShowLocation",&mWNViewShowLocation,false);
238 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false); 238 addItemBool("UseHighlightLightColor",&mUseHighlightLightColor,false);
239 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true); 239 addItemBool("ListViewMonthTimespan",&mListViewMonthTimespan,true);
240 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false); 240 addItemBool("TodoViewUsesCatColors",&mTodoViewUsesCatColors,false);
241 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false); 241 addItemBool("TodoViewShowsPercentage",&mTodoViewShowsPercentage,false);
242 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false); 242 addItemBool("TodoViewUsesSmallFont",&mTodoViewUsesSmallFont,false);
243 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false); 243 addItemBool("TodoViewUsesForegroundColor",&mTodoViewUsesForegroundColor,false);
244 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false); 244 addItemBool("MonthViewUsesForegroundColor",&mMonthViewUsesForegroundColor,false);
245#ifdef DESKTOP_VERSION 245#ifdef DESKTOP_VERSION
246 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true); 246 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,true);
247#else 247#else
248 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false); 248 addItemBool("UseInternalAlarmNotification",&mUseInternalAlarmNotification,false);
249#endif 249#endif
250 addItemInt("Day Begins",&mDayBegins,7); 250 addItemInt("Day Begins",&mDayBegins,7);
251 addItemInt("Working Hours Start",&mWorkingHoursStart,8); 251 addItemInt("Working Hours Start",&mWorkingHoursStart,8);
252 addItemInt("Working Hours End",&mWorkingHoursEnd,17); 252 addItemInt("Working Hours End",&mWorkingHoursEnd,17);
253 addItemBool("Exclude Holidays",&mExcludeHolidays,true); 253 addItemBool("Exclude Holidays",&mExcludeHolidays,true);
254 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true); 254 addItemBool("Exclude Saturdays",&mExcludeSaturdays,true);
255 255