author | zautrix <zautrix> | 2005-04-17 16:49:25 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-17 16:49:25 (UTC) |
commit | 70b45fe97813c4fd336b7ca8fdedab13f9c2e039 (patch) (side-by-side diff) | |
tree | 37e89cf6cc411af8c646003fcfb0d5975f38272c /korganizer | |
parent | 02dc5d8173393d2069951a5f847db5bdf69137f6 (diff) | |
download | kdepimpi-70b45fe97813c4fd336b7ca8fdedab13f9c2e039.zip kdepimpi-70b45fe97813c4fd336b7ca8fdedab13f9c2e039.tar.gz kdepimpi-70b45fe97813c4fd336b7ca8fdedab13f9c2e039.tar.bz2 |
fixes
-rw-r--r-- | korganizer/koeventviewer.cpp | 112 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 10 |
2 files changed, 68 insertions, 54 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index f39b5e1..c8c2f28 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -249,329 +249,341 @@ void KOEventViewer::addTag(const QString & tag,const QString & text) if(number !=-1) { if (number > 0) { int pos=0; QString tmp; for(int i=0;i<=number;i++) { pos=tmpText.find("\n"); tmp=tmpText.left(pos); tmpText=tmpText.right(tmpText.length()-pos-1); tmpStr+=tmp+"<br>"; } } else tmpStr += tmpText; tmpStr+="</" + tag + ">"; mText.append(tmpStr); } else { str += text + "</" + tag + ">"; mText.append(str); } } void KOEventViewer::setColorMode( int m ) { mColorMode = m; } void KOEventViewer::appendEvent(Event *event, int mode ) { mMailSubject = ""; mCurrentIncidence = event; bool shortDate = KOPrefs::instance()->mShortDateInViewer; + bool wideScreen = ( QApplication::desktop()->width() >= 640 ); topLevelWidget()->setCaption(i18n("Event Viewer")); if ( mode == 0 ) { addTag("h2",deTag(event->summary())); } else { if ( mColorMode == 1 ) { mText +="<font color=\"#00A000\">"; } if ( mColorMode == 2 ) { mText +="<font color=\"#C00000\">"; } // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; if ( mode == 1 ) { addTag("h2",i18n( "Local: " ) +deTag(event->summary())); } else { addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); } addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); if ( mColorMode ) mText += "</font>"; } mMailSubject += i18n( "Meeting " )+ event->summary(); if (event->cancelled ()) { mText +="<font color=\"#B00000\">"; addTag("i",i18n("This event has been cancelled!")); mText.append("<br>"); mText += "</font>"; mMailSubject += i18n("(cancelled)"); } if (event->doesFloat()) { if (event->isMultiDay()) { mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") .arg(event->dtStartDateStr(shortDate)) .arg(event->dtEndDateStr(shortDate))); } else { mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); } } else { if (event->isMultiDay()) { mText.append(i18n("<p><b>From:</b> %1</p> ") .arg(event->dtStartStr( shortDate))); mText.append(i18n("<p><b>To:</b> %1</p>") .arg(event->dtEndStr(shortDate))); } else { mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") .arg(event->dtStartTimeStr()) .arg(event->dtEndTimeStr())); mText.append(i18n("<p><b>On:</b> %1</p> ") .arg(event->dtStartDateStr( shortDate ))); } } if (!event->location().isEmpty()) { - addTag("b",i18n("Location: ")); - mText.append(deTag(event->location())+"<br>"); + addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); mMailSubject += i18n(" at ") + event->location(); } if (event->recurrence()->doesRecur()) { QString recurText = event->recurrence()->recurrenceText(); addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); bool ok; QDate start = QDate::currentDate(); QDateTime next; next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); if ( ok ) { - addTag("p",i18n("<b>Next recurrence is on:</b>") ); - addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); + if ( wideScreen ){ + addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); + } else { + addTag("p",i18n("<b>Next recurrence is on:</b>") ); + addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); + } mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); } else { bool last; QDate nextd; nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); if ( last ) { - addTag("p",i18n("<b>Last recurrence was on:</b>") ); - addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); + if ( wideScreen ){ + addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); + } else{ + addTag("p",i18n("<b>Last recurrence was on:</b>") ); + addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); + } } } } else { mMailSubject += i18n(" - " )+event->dtStartStr( true ); } if (event->isAlarmEnabled()) { Alarm *alarm =event->alarms().first() ; QDateTime t = alarm->time(); QString s =i18n("( %1 before )").arg( alarm->offsetText() ); - addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); - addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); + if(wideScreen ){ + addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); + }else{ + addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); + addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); + } //addTag("p",s); } - addTag("b",i18n("Access: ")); - mText.append(event->secrecyStr()+"<br>"); + addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); - - formatCategories(event); formatReadOnly(event); formatAttendees(event); if ( KOPrefs::instance()->mEVshowCreated ) { -#ifdef DESKTOP_VERSION - addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); -#else - addTag("p",i18n("<b>Created: ") +" </b>"); - addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); -#endif + if(wideScreen ){ + addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); + }else{ + addTag("p",i18n("<b>Created: ") +" </b>"); + addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); + } + } if ( KOPrefs::instance()->mEVshowChanged ) { -#ifdef DESKTOP_VERSION - addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); -#else - addTag("p",i18n("<b>Last modified: ") +" </b>"); - addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); -#endif + if(wideScreen ){ + addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); + }else{ + addTag("p",i18n("<b>Last modified: ") +" </b>"); + addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); + } } if ( KOPrefs::instance()->mEVshowDetails ) { if (!event->description().isEmpty()) { addTag("p",i18n("<b>Details: </b>")); addTag("p",deTag(event->description())); } } setText(mText); //QWhatsThis::add(this,mText); } void KOEventViewer::appendTodo(Todo *event, int mode ) { mMailSubject = ""; mCurrentIncidence = event; topLevelWidget()->setCaption(i18n("Todo Viewer")); bool shortDate = KOPrefs::instance()->mShortDateInViewer; + bool wideScreen = ( QApplication::desktop()->width() >= 640 ); if (mode == 0 ) addTag("h2",deTag(event->summary())); else { if ( mColorMode == 1 ) { mText +="<font color=\"#00A000\">"; } if ( mColorMode == 2 ) { mText +="<font color=\"#B00000\">"; } if ( mode == 1 ) { addTag("h2",i18n( "Local: " ) +deTag(event->summary())); } else { addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); } addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); if ( mColorMode ) mText += "</font>"; } mMailSubject += i18n( "Todo " )+ event->summary(); if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { mText +="<font color=\"#B00000\">"; addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); mText += "</font>"; } else { mText.append(i18n("<p><i>%1 % completed</i></p>") .arg(event->percentComplete())); } if (event->cancelled ()) { mText +="<font color=\"#B00000\">"; addTag("i",i18n("This todo has been cancelled!")); mText.append("<br>"); mText += "</font>"; mMailSubject += i18n("(cancelled)"); } if (event->recurrence()->doesRecur()) { QString recurText = event->recurrence()->recurrenceText(); addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); } if (event->hasStartDate()) { mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); } if (event->hasDueDate()) { mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); mMailSubject += i18n(" - " )+event->dtDueStr( true ); } - if (!event->location().isEmpty()) { - addTag("b",i18n("Location: ")); - mText.append(deTag(event->location())+"<br>"); + if (!event->location().isEmpty()) { + addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); mMailSubject += i18n(" at ") + event->location(); } mText.append(i18n("<p><b>Priority:</b> %2</p>") .arg(QString::number(event->priority()))); if (event->isAlarmEnabled()) { Alarm *alarm =event->alarms().first() ; QDateTime t = alarm->time(); - QString s =i18n("( %1 before )").arg( alarm->offsetText() ); - addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); - addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); - //addTag("p",s); + QString s =i18n("( %1 before )").arg( alarm->offsetText() ); + if ( wideScreen ) { + addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); + } else { + addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); + addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); + } } - addTag("b",i18n("Access: ")); - mText.append(event->secrecyStr()+"<br>"); + addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); formatCategories(event); formatReadOnly(event); formatAttendees(event); if ( KOPrefs::instance()->mEVshowCreated ) { -#ifdef DESKTOP_VERSION - addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); -#else - addTag("p",i18n("<b>Created: ") +" </b>"); - addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); -#endif - + if(wideScreen ){ + + addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); + + } else { + addTag("p",i18n("<b>Created: ") +" </b>"); + addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); + } } if ( KOPrefs::instance()->mEVshowChanged ) { -#ifdef DESKTOP_VERSION - addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); -#else - addTag("p",i18n("<b>Last modified: ") +" </b>"); - addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); -#endif - + if(wideScreen ){ + addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); + + } else { + addTag("p",i18n("<b>Last modified: ") +" </b>"); + addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); + } } if ( event->relatedTo() ) { addTag("b",i18n("Parent todo:<br>")); mText.append(deTag(event->relatedTo()->summary())+" [" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] <br>"); } QPtrList<Incidence> Relations = event->relations(); Incidence *to; if ( Relations.first() ) addTag("b",i18n("Sub todos:<br>")); for (to=Relations.first();to;to=Relations.next()) { mText.append( deTag(to->summary())+" [" +QString::number(to->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%]<br>"); } if ( KOPrefs::instance()->mEVshowDetails ) { if (!event->description().isEmpty()) { addTag("p",i18n("<b>Details: </b>")); addTag("p",deTag(event->description())); } } setText(mText); } void KOEventViewer::formatCategories(Incidence *event) { if (!event->categoriesStr().isEmpty()) { if (event->categories().count() == 1) { - addTag("h3",i18n("Category")); + addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace()); } else { - addTag("h3",i18n("Categories")); + addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ; } - addTag("p",event->categoriesStr()); } } void KOEventViewer::formatAttendees(Incidence *event) { QPtrList<Attendee> attendees = event->attendees(); if (attendees.count()) { QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); addTag("h3",i18n("Organizer")); mText.append("<ul><li>"); #ifndef KORG_NOKABC #ifdef DESKTOP_VERSION KABC::AddressBook *add_book = KABC::StdAddressBook::self(); KABC::Addressee::List addressList; addressList = add_book->findByEmail(event->organizer()); KABC::Addressee o = addressList.first(); if (!o.isEmpty() && addressList.size()<2) { mText += "<a href=\"uid:" + o.uid() + "\">"; mText += o.formattedName(); mText += "</a>\n"; } else { mText.append(event->organizer()); } #else //DESKTOP_VERSION mText += "<a href=\"uid:organizer\">"; mText += event->organizer(); mText += "</a>\n"; #endif //DESKTOP_VERSION diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 0a608dc..25be63a 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp @@ -435,85 +435,87 @@ KOTodoView::KOTodoView(Calendar *calendar,QWidget* parent,const char* name) : mTodoListView->setItemsRenameable( true ); mTodoListView->setRenameable( 0 ); mTodoListView->setColumnWidth( 0, 120 ); mTodoListView->setColumnWidthMode(0, QListView::Manual); mTodoListView->setColumnWidthMode(1, QListView::Manual); mTodoListView->setColumnWidthMode(2, QListView::Manual); mTodoListView->setColumnWidthMode(3, QListView::Manual); mTodoListView->setColumnWidthMode(4, QListView::Manual); mTodoListView->setColumnWidthMode(5, QListView::Manual); mTodoListView->setColumnWidthMode(6, QListView::Manual); mTodoListView->setColumnWidthMode(7, QListView::Manual); mTodoListView->setColumnWidthMode(8, QListView::Manual); mKOTodoViewWhatsThis = new KOTodoViewWhatsThis(mTodoListView->viewport(),this); mPriorityPopupMenu = new QPopupMenu(this); for (int i = 1; i <= 5; i++) { QString label = QString ("%1").arg (i); mPriority[mPriorityPopupMenu->insertItem (label)] = i; } connect (mPriorityPopupMenu, SIGNAL(activated (int)), SLOT (setNewPriority(int))); mPercentageCompletedPopupMenu = new QPopupMenu(this); for (int i = 0; i <= 100; i+=20) { QString label = QString ("%1 %").arg (i); mPercentage[mPercentageCompletedPopupMenu->insertItem (label)] = i; } connect (mPercentageCompletedPopupMenu, SIGNAL (activated (int)), SLOT (setNewPercentage (int))); - mItemPopupMenu = new QPopupMenu(this); + mItemPopupMenu = new QPopupMenu(this); + mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, + SLOT (toggleRunningItem())); + mItemPopupMenu->insertSeparator(); mItemPopupMenu->insertItem(i18n("Show..."), this, SLOT (showTodo())); mItemPopupMenu->insertItem(i18n("Edit..."), this, SLOT (editTodo())); mItemPopupMenu->insertItem( i18n("Delete"), this, SLOT (deleteTodo())); mItemPopupMenu->insertItem( i18n("Clone..."), this, SLOT (cloneTodo())); mItemPopupMenu->insertItem( i18n("Move..."), this, SLOT (moveTodo())); mItemPopupMenu->insertItem( i18n("Beam..."), this, SLOT (beamTodo())); mItemPopupMenu->insertItem( i18n("Toggle Cancel"), this, SLOT (cancelTodo())); mItemPopupMenu->insertSeparator(); - - mItemPopupMenu->insertItem( i18n("Start/Stop todo..."), this, - SLOT (toggleRunningItem())); + /* mItemPopupMenu->insertItem( i18n("New Todo..."), this, SLOT (newTodo())); + */ mItemPopupMenu->insertItem(i18n("New Sub-Todo..."), this, SLOT (newSubTodo())); mItemPopupMenu->insertItem(i18n("Unparent Todo"), this, SLOT (unparentTodo()),0,21); mItemPopupMenu->insertItem(i18n("Reparent Todo"), this, SLOT (reparentTodo()),0,22); mItemPopupMenu->insertSeparator(); #if 0 mItemPopupMenu->insertItem(i18n("Delete completed To-Dos","Purge Completed"), this, SLOT( purgeCompleted() ) ); mItemPopupMenu->insertItem(i18n("toggle completed To-Dos","Show Completed"), this, SLOT( toggleCompleted() ),0, 33 ); mItemPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), this, SLOT( toggleQuickTodo() ),0, 34 ); mItemPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), this, SLOT( toggleRunning() ),0, 35 ); #endif mPopupMenu = new QPopupMenu(this); mPopupMenu->insertItem(SmallIconSet("todo"), i18n("New Todo..."), this, SLOT (newTodo()),0,1); mPopupMenu->insertItem(i18n("delete completed To-Dos","Purge Completed"), this, SLOT(purgeCompleted()),0,2); mPopupMenu->insertItem(i18n("Show Completed"), this, SLOT( toggleCompleted() ),0,3 ); mPopupMenu->insertItem(i18n("toggle quick todo","Show Quick Todo"), this, SLOT( toggleQuickTodo() ),0,4 ); mPopupMenu->insertItem(i18n("toggle running todo","Hide not Running"), this, SLOT( toggleRunning() ),0,5 ); mPopupMenu->insertItem(i18n(" set all open","Display all opened"), this, SLOT( setAllOpen() ),0,6 ); mPopupMenu->insertItem(i18n(" set all close","Display all closed"), |