summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-04-17 10:42:07 (UTC)
committer zautrix <zautrix>2005-04-17 10:42:07 (UTC)
commitff7743ec82aa6d70325e613d0a1054c7de83a76c (patch) (unidiff)
treee6d4c46a26e120817acd5ab7e47ef41b1428700b /korganizer
parentfd67a473a94c5a3d63a89c52fb8f612cb19b5363 (diff)
downloadkdepimpi-ff7743ec82aa6d70325e613d0a1054c7de83a76c.zip
kdepimpi-ff7743ec82aa6d70325e613d0a1054c7de83a76c.tar.gz
kdepimpi-ff7743ec82aa6d70325e613d0a1054c7de83a76c.tar.bz2
fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp95
-rw-r--r--korganizer/komonthview.h8
-rw-r--r--korganizer/koprefs.cpp1
-rw-r--r--korganizer/koprefs.h1
-rw-r--r--korganizer/koprefsdialog.cpp4
-rw-r--r--korganizer/koviewmanager.cpp7
6 files changed, 105 insertions, 11 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index b175f9a..2b7e41f 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -403,18 +403,28 @@ void MonthViewItem::paint(QPainter *p)
403 if( pmheight < fm.height() ) 403 if( pmheight < fm.height() )
404 yPos = fm.ascent() + fm.leading()/2; 404 yPos = fm.ascent() + fm.leading()/2;
405 else 405 else
406 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 406 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
407 p->setPen( palette().color( QPalette::Normal, sel ? \ 407 p->setPen( palette().color( QPalette::Normal, sel ? \
408 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 408 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
409 p->drawText( x, yPos, text() ); 409 if ( KOPrefs::instance()->mMonthShowTimes || isWeekItem) {
410 if ( mIncidence->cancelled() ) { 410 p->drawText( x, yPos, text() );
411 int wid = fm.width( text() ); 411 if ( mIncidence->cancelled() ) {
412 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 412 int wid = fm.width( text() );
413 } 413 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
414 414 }
415 } else {
416 QString pText = text();
417 if( pText.mid(2,1) == ":" )
418 pText = pText.mid( 6 );
419 p->drawText( x, yPos, pText );
420 if ( mIncidence->cancelled() ) {
421 int wid = fm.width( pText );
422 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
423 }
424 }
415} 425}
416 426
417int MonthViewItem::height(const QListBox *lb) const 427int MonthViewItem::height(const QListBox *lb) const
418{ 428{
419 int ret = 10; 429 int ret = 10;
420 if ( lb ) 430 if ( lb )
@@ -1039,25 +1049,29 @@ void MonthViewCell::newEvent()
1039{ 1049{
1040 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1050 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1041 emit newEventSignal( dt ); 1051 emit newEventSignal( dt );
1042} 1052}
1043void MonthViewCell::cellClicked( QListBoxItem *item ) 1053void MonthViewCell::cellClicked( QListBoxItem *item )
1044{ 1054{
1055 mMonthView->setSelectedCell( this );
1045 qDebug("CELL "); 1056 qDebug("CELL ");
1046 if ( item == 0 ) { 1057 if ( item == 0 ) {
1047 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); 1058 QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
1048 emit newEventSignal( dt ); 1059 emit newEventSignal( dt );
1049 return; 1060 return;
1050 } 1061 }
1051 1062
1052} 1063}
1053 1064
1054void MonthViewCell::contextMenu( QListBoxItem *item ) 1065void MonthViewCell::contextMenu( QListBoxItem *item )
1055{ 1066{
1056 if ( !item ) return; 1067 mMonthView->setPopupCell( this );
1057 1068 if ( !item ) {
1069 mMonthView->showContextMenu( 0 );
1070 return;
1071 }
1058 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); 1072 MonthViewItem *eventItem = static_cast<MonthViewItem *>( item );
1059 Incidence *incidence = eventItem->incidence(); 1073 Incidence *incidence = eventItem->incidence();
1060 if ( incidence ) mMonthView->showContextMenu( incidence ); 1074 if ( incidence ) mMonthView->showContextMenu( incidence );
1061} 1075}
1062 1076
1063void MonthViewCell::selection( QListBoxItem *item ) 1077void MonthViewCell::selection( QListBoxItem *item )
@@ -1080,12 +1094,13 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1080{ 1094{
1081 mFlagKeyPressed = false; 1095 mFlagKeyPressed = false;
1082 mShortDayLabelsM = false; 1096 mShortDayLabelsM = false;
1083 mShortDayLabelsW = false; 1097 mShortDayLabelsW = false;
1084 skipResize = false; 1098 skipResize = false;
1085 clPending = true; 1099 clPending = true;
1100 mPopupCell = 0;
1086 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); 1101 mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" );
1087 mWidStack = new QWidgetStack( this ); 1102 mWidStack = new QWidgetStack( this );
1088 QVBoxLayout* hb = new QVBoxLayout( this ); 1103 QVBoxLayout* hb = new QVBoxLayout( this );
1089 mMonthView = new QWidget( mWidStack ); 1104 mMonthView = new QWidget( mWidStack );
1090 mWeekView = new QWidget( mWidStack ); 1105 mWeekView = new QWidget( mWidStack );
1091#if QT_VERSION >= 0x030000 1106#if QT_VERSION >= 0x030000
@@ -1197,12 +1212,35 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name)
1197 SLOT( prevCell() ) ); 1212 SLOT( prevCell() ) );
1198 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont ); 1213 cell->updateConfig(KOPrefs::instance()->mMonthViewUsesBigFont );
1199 } 1214 }
1200 1215
1201 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); 1216 //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) );
1202 mContextMenu = eventPopup(); 1217 mContextMenu = eventPopup();
1218 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1219 i18n("New Event..."),this,
1220 SLOT(slotNewEvent()),false);
1221 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1222 i18n("New Todo..."),this,
1223 SLOT(slotNewTodo()),false);
1224 mContextMenu->addAdditionalItem(QIconSet(QPixmap()),
1225 i18n("Journal"),this,
1226 SLOT(slotEditJournal()),false);
1227
1228
1229
1230 QString pathString = "";
1231 if ( !KOPrefs::instance()->mToolBarMiniIcons ) {
1232 if ( QApplication::desktop()->width() < 480 )
1233 pathString += "icons16/";
1234 } else
1235 pathString += "iconsmini/";
1236 mNewItemMenu = new QPopupMenu( this );
1237 mNewItemMenu->insertItem( SmallIcon( pathString +"newevent" ), i18n("New Event..."),this, SLOT(slotNewEvent()));
1238 mNewItemMenu->insertItem( SmallIcon( pathString +"newtodo" ),i18n("New Todo..."),this,SLOT(slotNewTodo()),false);
1239 mNewItemMenu->insertItem( SmallIcon( pathString +"journal" ),i18n("Journal"),this,SLOT(slotEditJournal()),false);
1240
1203 // updateConfig(); //useless here... 1241 // updateConfig(); //useless here...
1204 // ... but we need mWidthLongDayLabel computed 1242 // ... but we need mWidthLongDayLabel computed
1205 QFontMetrics fontmetric(mDayLabels[0]->font()); 1243 QFontMetrics fontmetric(mDayLabels[0]->font());
1206 mWidthLongDayLabel = 0; 1244 mWidthLongDayLabel = 0;
1207 for (int i = 0; i < 7; i++) { 1245 for (int i = 0; i < 7; i++) {
1208 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1)); 1246 int width = fontmetric.width(KOGlobals::self()->calendarSystem()->weekDayName(i+1));
@@ -1890,13 +1928,18 @@ void KOMonthView::computeLayout()
1890 updatePossible = true; 1928 updatePossible = true;
1891 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1929 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1892} 1930}
1893 1931
1894void KOMonthView::showContextMenu( Incidence *incidence ) 1932void KOMonthView::showContextMenu( Incidence *incidence )
1895{ 1933{
1896 mContextMenu->showIncidencePopup(incidence); 1934 if( incidence )
1935 mContextMenu->showIncidencePopup(incidence);
1936 else {
1937 //qDebug("KOMonthView::showContextMenu ");
1938 mNewItemMenu->popup(QCursor::pos());
1939 }
1897 /* 1940 /*
1898 if( incidence && incidence->type() == "Event" ) { 1941 if( incidence && incidence->type() == "Event" ) {
1899 Event *event = static_cast<Event *>(incidence); 1942 Event *event = static_cast<Event *>(incidence);
1900 mContextMenu->showEventPopup(event); 1943 mContextMenu->showEventPopup(event);
1901 } else { 1944 } else {
1902 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; 1945 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
@@ -1906,13 +1949,13 @@ void KOMonthView::showContextMenu( Incidence *incidence )
1906MonthViewCell * KOMonthView::selectedCell( ) 1949MonthViewCell * KOMonthView::selectedCell( )
1907{ 1950{
1908 return mSelectedCell; 1951 return mSelectedCell;
1909} 1952}
1910void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1953void KOMonthView::setSelectedCell( MonthViewCell *cell )
1911{ 1954{
1912 //qDebug("KOMonthView::setSelectedCell "); 1955 //qDebug("KOMonthView::setSelectedCell %d", cell);
1913 if ( mSelectedCell && mSelectedCell != cell ) { 1956 if ( mSelectedCell && mSelectedCell != cell ) {
1914 MonthViewCell * mvc = mSelectedCell; 1957 MonthViewCell * mvc = mSelectedCell;
1915 mSelectedCell = cell; 1958 mSelectedCell = cell;
1916 mvc->deselect(); 1959 mvc->deselect();
1917 } else 1960 } else
1918 mSelectedCell = cell; 1961 mSelectedCell = cell;
@@ -2011,6 +2054,38 @@ void KOMonthView::nextCell()
2011 bool res = focusNextPrevChild ( true ); 2054 bool res = focusNextPrevChild ( true );
2012} 2055}
2013void KOMonthView::prevCell() 2056void KOMonthView::prevCell()
2014{ 2057{
2015 focusNextPrevChild ( false ); 2058 focusNextPrevChild ( false );
2016} 2059}
2060
2061void KOMonthView::slotNewTodo()
2062{
2063 //qDebug("KOMonthView::slotNewTodo() ");
2064 if ( mPopupCell ){
2065 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
2066 emit newTodoSignal(dt,true);
2067 }
2068 mPopupCell = 0;
2069}
2070void KOMonthView::slotNewEvent()
2071{
2072 if ( mPopupCell ) {
2073 QDateTime dt( mPopupCell->date(), QTime( KOPrefs::instance()->mStartTime, 0 ) );
2074 emit newEventSignal( dt );
2075 }
2076 //qDebug("KOMonthView::slotNewEvent() ");
2077 mPopupCell = 0;
2078}
2079
2080void KOMonthView::slotEditJournal()
2081{
2082 if ( mPopupCell )
2083 emit showJournalSignal( 7, mPopupCell->date() );
2084 //qDebug("KOMonthView::slotEditJournal() ");
2085 mPopupCell = 0;
2086}
2087
2088void KOMonthView::setPopupCell( MonthViewCell * c)
2089{
2090 mPopupCell = c;
2091}
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index c6b6b5e..de5c014 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -268,26 +268,32 @@ class KOMonthView: public KOEventView
268 268
269 void clearSelection(); 269 void clearSelection();
270 270
271 void showContextMenu( Incidence * ); 271 void showContextMenu( Incidence * );
272 272
273 void setSelectedCell( MonthViewCell * ); 273 void setSelectedCell( MonthViewCell * );
274 void setPopupCell( MonthViewCell * );
274 void switchView(); 275 void switchView();
275 void setKeyBoardFocus(); 276 void setKeyBoardFocus();
276 void setKeyBFocus(); 277 void setKeyBFocus();
277 278
278 protected slots: 279 protected slots:
280 void slotNewTodo();
281 void slotNewEvent();
282 void slotEditJournal();
279 void slotComputeLayout(); 283 void slotComputeLayout();
280 void selectInternalWeekNum ( int ); 284 void selectInternalWeekNum ( int );
281 void processSelectionChange(); 285 void processSelectionChange();
282 signals: 286 signals:
283 void nextMonth(); 287 void nextMonth();
284 void prevMonth(); 288 void prevMonth();
285 void selectWeekNum ( int ); 289 void selectWeekNum ( int );
286 void selectMonth (); 290 void selectMonth ();
287 void showDaySignal( QDate ); 291 void showDaySignal( QDate );
292 void newTodoSignal( QDateTime, bool );
293 void showJournalSignal( int,QDate );
288 protected: 294 protected:
289 void resizeEvent(QResizeEvent *); 295 void resizeEvent(QResizeEvent *);
290 void viewChanged(); 296 void viewChanged();
291 void updateDayLabels(); 297 void updateDayLabels();
292 298
293 private: 299 private:
@@ -319,14 +325,16 @@ class KOMonthView: public KOEventView
319 bool mShortDayLabelsW; 325 bool mShortDayLabelsW;
320 int mWidthLongDayLabel; 326 int mWidthLongDayLabel;
321 327
322 QDate mStartDate; 328 QDate mStartDate;
323 329
324 MonthViewCell *mSelectedCell; 330 MonthViewCell *mSelectedCell;
331 MonthViewCell *mPopupCell;
325 bool mFlagKeyPressed; 332 bool mFlagKeyPressed;
326 KOEventPopupMenu *mContextMenu; 333 KOEventPopupMenu *mContextMenu;
334 QPopupMenu *mNewItemMenu;
327 void keyPressEvent ( QKeyEvent * ) ; 335 void keyPressEvent ( QKeyEvent * ) ;
328 void keyReleaseEvent ( QKeyEvent * ) ; 336 void keyReleaseEvent ( QKeyEvent * ) ;
329 337
330}; 338};
331 339
332#endif 340#endif
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index a571ed4..34044ab 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -234,12 +234,13 @@ KOPrefs::KOPrefs() :
234 addItemBool("Show Daily Recurrences",&mDailyRecur,true); 234 addItemBool("Show Daily Recurrences",&mDailyRecur,true);
235 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true); 235 addItemBool("Show Weekly Recurrences",&mWeeklyRecur,true);
236 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true); 236 addItemBool("Show Month Daily Recurrences",&mMonthDailyRecur,true);
237 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true); 237 addItemBool("Show Month Weekly Recurrences",&mMonthWeeklyRecur,true);
238 addItemBool("ShowShortMonthName",&mMonthShowShort,false); 238 addItemBool("ShowShortMonthName",&mMonthShowShort,false);
239 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true); 239 addItemBool("ShowIconsInMonthCell",&mMonthShowIcons,true);
240 addItemBool("ShowTimesInMonthCell",&mMonthShowTimes,true);
240#ifdef DESKTOP_VERION 241#ifdef DESKTOP_VERION
241 addItemBool("Enable ToolTips",&mEnableToolTips,true); 242 addItemBool("Enable ToolTips",&mEnableToolTips,true);
242#else 243#else
243 addItemBool("Enable ToolTips",&mEnableToolTips,false); 244 addItemBool("Enable ToolTips",&mEnableToolTips,false);
244#endif 245#endif
245 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false); 246 addItemBool("Enable MonthView ScrollBars",&mEnableMonthScroll,false);
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 2a0ee64..e06df1c 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -156,12 +156,13 @@ class KOPrefs : public KPimPrefs
156 bool mShowFullMenu; 156 bool mShowFullMenu;
157 bool mDailyRecur; 157 bool mDailyRecur;
158 bool mWeeklyRecur; 158 bool mWeeklyRecur;
159 bool mMonthDailyRecur; 159 bool mMonthDailyRecur;
160 bool mMonthWeeklyRecur; 160 bool mMonthWeeklyRecur;
161 bool mMonthShowIcons; 161 bool mMonthShowIcons;
162 bool mMonthShowTimes;
162 bool mMonthShowShort; 163 bool mMonthShowShort;
163 bool mEnableToolTips; 164 bool mEnableToolTips;
164 bool mEnableMonthScroll; 165 bool mEnableMonthScroll;
165 bool mFullViewMonth; 166 bool mFullViewMonth;
166 bool mMonthViewUsesCategoryColor; 167 bool mMonthViewUsesCategoryColor;
167 bool mFullViewTodo; 168 bool mFullViewTodo;
diff --git a/korganizer/koprefsdialog.cpp b/korganizer/koprefsdialog.cpp
index ad3c61c..cb9c272 100644
--- a/korganizer/koprefsdialog.cpp
+++ b/korganizer/koprefsdialog.cpp
@@ -761,13 +761,15 @@ void KOPrefsDialog::setupViewsTab()
761 weeklyRecur = 761 weeklyRecur =
762 addWidBool(i18n("short month"), 762 addWidBool(i18n("short month"),
763 &(KOPrefs::instance()->mMonthShowShort),habo); 763 &(KOPrefs::instance()->mMonthShowShort),habo);
764 weeklyRecur = 764 weeklyRecur =
765 addWidBool(i18n("icons"), 765 addWidBool(i18n("icons"),
766 &(KOPrefs::instance()->mMonthShowIcons),habo); 766 &(KOPrefs::instance()->mMonthShowIcons),habo);
767 767 weeklyRecur =
768 addWidBool(i18n("times"),
769 &(KOPrefs::instance()->mMonthShowTimes),habo);
768 topLayout->addMultiCellWidget(habo,ii, ii,0,1); 770 topLayout->addMultiCellWidget(habo,ii, ii,0,1);
769 ii++; 771 ii++;
770#ifdef DESKTOP_VERSION 772#ifdef DESKTOP_VERSION
771 KPrefsDialogWidBool *enableMonthScroll = 773 KPrefsDialogWidBool *enableMonthScroll =
772 addWidBool(i18n("Enable scrollbars in month view cells"), 774 addWidBool(i18n("Enable scrollbars in month view cells"),
773 &(KOPrefs::instance()->mEnableMonthScroll),topFrame); 775 &(KOPrefs::instance()->mEnableMonthScroll),topFrame);
diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp
index 406e741..f1f2dd2 100644
--- a/korganizer/koviewmanager.cpp
+++ b/korganizer/koviewmanager.cpp
@@ -596,12 +596,19 @@ void KOViewManager::createMonthView()
596if (!mMonthView) { 596if (!mMonthView) {
597 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView"); 597 mMonthView = new KOMonthView(mMainView->calendar(), mMainView->viewStack(), "KOViewManager::MonthView");
598 598
599 addView(mMonthView); 599 addView(mMonthView);
600 // mMonthView->show(); 600 // mMonthView->show();
601 // SIGNALS/SLOTS FOR MONTH VIEW 601 // SIGNALS/SLOTS FOR MONTH VIEW
602
603 connect(mMonthView,SIGNAL(showJournalSignal( int, QDate )),SLOT(showDateView( int, QDate )));
604
605 connect(mMonthView, SIGNAL(newTodoSignal(QDateTime,bool)),
606 mMainView, SLOT(newTodoDateTime(QDateTime, bool)));
607
608
602 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)), 609 connect(mMonthView, SIGNAL(newEventSignal(QDateTime)),
603 mMainView, SLOT(newEvent(QDateTime))); 610 mMainView, SLOT(newEvent(QDateTime)));
604 611
605 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)), 612 connect(mMonthView, SIGNAL(showIncidenceSignal(Incidence *)),
606 mMainView, SLOT(showIncidence(Incidence *))); 613 mMainView, SLOT(showIncidence(Incidence *)));
607 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)), 614 connect(mMonthView, SIGNAL(editIncidenceSignal(Incidence *)),