summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-29 21:05:07 (UTC)
committer zautrix <zautrix>2004-10-29 21:05:07 (UTC)
commit3c0edb4b4c4a77b334331749dfde776911c3a3a0 (patch) (unidiff)
tree89de7078a1a062c19b2f13ededd49f471c362abf
parenta7e2fe5bb10af47a239b8b014a210568cc79287a (diff)
downloadkdepimpi-3c0edb4b4c4a77b334331749dfde776911c3a3a0.zip
kdepimpi-3c0edb4b4c4a77b334331749dfde776911c3a3a0.tar.gz
kdepimpi-3c0edb4b4c4a77b334331749dfde776911c3a3a0.tar.bz2
KO WN view fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addressee.cpp3
-rw-r--r--kabc/phonenumber.cpp31
-rw-r--r--kabc/plugins/ldap/ldapE.pro2
-rw-r--r--korganizer/kowhatsnextview.cpp42
-rw-r--r--korganizer/kowhatsnextview.h2
5 files changed, 38 insertions, 42 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 028d3bb..eec0f1f 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -321,13 +321,14 @@ void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false)
321 found = true; 321 found = true;
322 (*it).setType( ( *phoneItAD ).type() ); 322 (*it).setType( ( *phoneItAD ).type() );
323 (*it).setNumber( ( *phoneItAD ).number() ); 323 (*it).setNumber( ( *phoneItAD ).number() );
324 break; 324 break;
325 } 325 }
326 } 326 }
327 if ( isSubSet && ! found ) 327 // if ( isSubSet && ! found )
328 if ( ! found ) // LR try this one...
328 mData->phoneNumbers.append( *phoneItAD ); 329 mData->phoneNumbers.append( *phoneItAD );
329 } 330 }
330 if ( isSubSet ) { 331 if ( isSubSet ) {
331 // ************* emails; 332 // ************* emails;
332 t = mData->emails; 333 t = mData->emails;
333 tAD = ad.mData->emails; 334 tAD = ad.mData->emails;
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp
index 3d82553..abb3b3b 100644
--- a/kabc/phonenumber.cpp
+++ b/kabc/phonenumber.cpp
@@ -86,30 +86,25 @@ void PhoneNumber::simplifyType()
86 else if ( mType & Work ) mType = Work ; 86 else if ( mType & Work ) mType = Work ;
87 else if ( mType & Home ) mType = Home; 87 else if ( mType & Home ) mType = Home;
88 else mType = Pref; 88 else mType = Pref;
89} 89}
90bool PhoneNumber::contains( const PhoneNumber &p ) 90bool PhoneNumber::contains( const PhoneNumber &p )
91{ 91{
92 QString Number; 92 PhoneNumber myself;
93 QString Num; 93 PhoneNumber other;
94 uint i; 94 myself = *this;
95 Number = mNumber.stripWhiteSpace (); 95 other = p;
96 Num = ""; 96 myself.simplifyNumber();
97 for ( i = 0; i < Number.length(); ++i) { 97 other.simplifyNumber();
98 if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' ) 98 if ( myself.number() != other.number ())
99 Num += Number.at(i); 99 return false;
100 } 100 myself.simplifyType();
101 QString NumberR; 101 other.simplifyType();
102 QString NumR; 102 if ( myself.type() == other.type())
103 NumberR = p.mNumber.stripWhiteSpace (); 103 return true;
104 NumR = ""; 104 return false;
105 for ( i = 0; i < NumberR.length(); ++i) {
106 if ( NumberR.at(i).isDigit() || NumberR.at(i) == '+'|| NumberR.at(i) == '*'|| NumberR.at(i) == '#' )
107 NumR += NumberR.at(i);
108 }
109 return (Num == NumR);
110} 105}
111 106
112void PhoneNumber::setId( const QString &id ) 107void PhoneNumber::setId( const QString &id )
113{ 108{
114 mId = id; 109 mId = id;
115} 110}
diff --git a/kabc/plugins/ldap/ldapE.pro b/kabc/plugins/ldap/ldapE.pro
index df3c94c..57b6f84 100644
--- a/kabc/plugins/ldap/ldapE.pro
+++ b/kabc/plugins/ldap/ldapE.pro
@@ -4,13 +4,13 @@ CONFIG += qt warn_on release
4 4
5TARGET = microkabc_ldap 5TARGET = microkabc_ldap
6INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include 6INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include
7OBJECTS_DIR = obj/$(PLATFORM) 7OBJECTS_DIR = obj/$(PLATFORM)
8MOC_DIR = moc/$(PLATFORM) 8MOC_DIR = moc/$(PLATFORM)
9DESTDIR = $(QPEDIR)/lib 9DESTDIR = $(QPEDIR)/lib
10LIBS += -lmicrokde -lkamicrokabc 10LIBS += -lmicrokde -lmicrokabc
11LIBS += -L$(QPEDIR)/lib 11LIBS += -L$(QPEDIR)/lib
12 12
13INTERFACES = \ 13INTERFACES = \
14 14
15HEADERS = \ 15HEADERS = \
16 resourceldap.h \ 16 resourceldap.h \
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index aa33588..2f7409d 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -67,28 +67,20 @@ KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
67 // mDateLabel->setAlignment(AlignCenter); 67 // mDateLabel->setAlignment(AlignCenter);
68 setFont( KOPrefs::instance()->mWhatsNextFont ); 68 setFont( KOPrefs::instance()->mWhatsNextFont );
69 mView = new WhatsNextTextBrowser(this); 69 mView = new WhatsNextTextBrowser(this);
70 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); 70 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
71 QStyleSheet* stsh = mView->styleSheet(); 71 QStyleSheet* stsh = mView->styleSheet();
72 QStyleSheetItem * style ; 72 QStyleSheetItem * style ;
73 style = stsh->item ("a" );
74 if ( style ) {
75 style->setMargin(QStyleSheetItem::MarginAll,0);
76 }
77 style = stsh->item ("h2" ); 73 style = stsh->item ("h2" );
78 if ( style ) { 74 if ( style ) {
79 style->setMargin(QStyleSheetItem::MarginAll,0); 75 style->setMargin(QStyleSheetItem::MarginAll,0);
80 } 76 }
81 style = stsh->item ("h3" ); 77 style = stsh->item ("h3" );
82 if ( style ) { 78 if ( style ) {
83 style->setMargin(QStyleSheetItem::MarginAll,0); 79 style->setMargin(QStyleSheetItem::MarginAll,0);
84 } 80 }
85 style = stsh->item ("table" );
86 if ( style ) {
87 style->setMargin(QStyleSheetItem::MarginAll,0);
88 }
89 mEventViewer = 0; 81 mEventViewer = 0;
90 82
91 QBoxLayout *topLayout = new QVBoxLayout(this); 83 QBoxLayout *topLayout = new QVBoxLayout(this);
92 // topLayout->addWidget(mDateLabel); 84 // topLayout->addWidget(mDateLabel);
93 topLayout->addWidget(mView); 85 topLayout->addWidget(mView);
94 mTimer = new QTimer( this ); 86 mTimer = new QTimer( this );
@@ -158,13 +150,13 @@ void KOWhatsNextView::updateView()
158 //qDebug("KOWhatsNextView::updateView() "); 150 //qDebug("KOWhatsNextView::updateView() ");
159 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); 151 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate()));
160 KIconLoader kil("korganizer"); 152 KIconLoader kil("korganizer");
161 QString ipath;// = new QString(); 153 QString ipath;// = new QString();
162 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); 154 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath);
163 //<big><big><strong>" + date + "</strong></big></big>\n"; 155 //<big><big><strong>" + date + "</strong></big></big>\n";
164 mText = "<qt><table width=\"100%\">\n"; 156 mText = "<table width=\"100%\">\n";
165 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 157 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
166#ifdef DESKTOP_VERSION 158#ifdef DESKTOP_VERSION
167 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; 159 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
168#else 160#else
169 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 161 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
170#endif 162#endif
@@ -213,20 +205,24 @@ void KOWhatsNextView::updateView()
213 // mText += "<h2>"; 205 // mText += "<h2>";
214 //mText += " <img src=\""; 206 //mText += " <img src=\"";
215 //mText += ipath; 207 //mText += ipath;
216 //mText += "\">"; 208 //mText += "\">";
217 if ( ! itemAdded ) { 209 if ( ! itemAdded ) {
218 appendDay ( iii, mEventDate ); 210 appendDay ( iii, mEventDate );
219 itemAdded = true;
220 211
221 } 212 }
213 // for first day (iii == 0)
214 // we may have syncevents, or events in the past, which maybe should nor be diaplayed
215 // for that reason we cannot append <table> in appendDay () for iii == 0
216 // we must append it in the first successful call of appendEvent()
222 Event *ev = events.first(); 217 Event *ev = events.first();
223 while(ev) { 218 while(ev) {
224 //qDebug("+++++event append %s", ev->summary().latin1()); 219 //qDebug("+++++event append %s", ev->summary().latin1());
225 if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { 220 if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) {
226 appendEvent(ev, false , iii!= 0 ); 221 if ( appendEvent(ev, false , iii!= 0,!itemAdded ) )
222 itemAdded = true;
227 } 223 }
228 ev = events.next(); 224 ev = events.next();
229 } 225 }
230 226
231 //mText += "</table>\n"; 227 //mText += "</table>\n";
232 } 228 }
@@ -239,20 +235,20 @@ void KOWhatsNextView::updateView()
239 itemAdded = true; 235 itemAdded = true;
240 } 236 }
241 appendEvent(todo); 237 appendEvent(todo);
242 } 238 }
243 todo = todos.next(); 239 todo = todos.next();
244 } 240 }
245 if ( !itemAdded && iii == 0 ) { 241 if ( !itemAdded && iii == 0 ) {
246 // appendDay ( iii, mEventDate ); 242 // appendDay ( iii, mEventDate );
247 //mText += "<table>"; 243 //mText += "<table>";
248 // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; 244 // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n";
249 mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n"; 245 mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n";
250 //mText +="</table>"; 246 //mText +="</table>";
251 } 247 }
252 if ( itemAdded ) 248 if ( itemAdded )
253 mText += "</table>\n"; 249 mText += "</table>\n";
254 mEventDate = mEventDate.addDays( 1 ); 250 mEventDate = mEventDate.addDays( 1 );
255 } 251 }
256 252
257 int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; 253 int topmostPrios = KOPrefs::instance()->mWhatsNextPrios;
258 if (todos.count() > 0 && topmostPrios > 0 ) { 254 if (todos.count() > 0 && topmostPrios > 0 ) {
@@ -340,13 +336,13 @@ void KOWhatsNextView::updateView()
340 to = todos.next(); 336 to = todos.next();
341 } 337 }
342 } 338 }
343 if (replys > 0 ) mText += "</table>\n"; 339 if (replys > 0 ) mText += "</table>\n";
344 340
345 341
346 mText += "</td></tr>\n</table></qt>\n"; 342 mText += "</td></tr>\n</table>\n";
347 343
348 mView->setText(mText); 344 mView->setText(mText);
349 mView->setFocus(); 345 mView->setFocus();
350 346
351 // QPixmap bPix = SmallIcon( "back" ); 347 // QPixmap bPix = SmallIcon( "back" );
352 // qDebug("xxxxxxxxxxxxxxxxxxxxx "); 348 // qDebug("xxxxxxxxxxxxxxxxxxxxx ");
@@ -354,22 +350,22 @@ void KOWhatsNextView::updateView()
354 // test->setBackgroundMode(FixedPixmap ); 350 // test->setBackgroundMode(FixedPixmap );
355 // test->setBackgroundPixmap ( bPix ); 351 // test->setBackgroundPixmap ( bPix );
356 // test->resize( 300, 400 ); 352 // test->resize( 300, 400 );
357 // test->show(); 353 // test->show();
358 // mView->setBackgroundMode(FixedPixmap ); 354 // mView->setBackgroundMode(FixedPixmap );
359 // mView->setBackgroundPixmap ( bPix ); 355 // mView->setBackgroundPixmap ( bPix );
360 // qDebug("%s ",mText.latin1()); 356 qDebug("%s ",mText.latin1());
361} 357}
362 358
363void KOWhatsNextView::appendDay( int i, QDate eventDate ) 359void KOWhatsNextView::appendDay( int i, QDate eventDate )
364{ 360{
365 QString date; 361 QString date;
366 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); 362 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer);
367 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { 363 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) {
368 if ( i == 0 ) { 364 if ( i == 0 ) {
369 mText += "<table>\n"; 365 //mText += "<table>\n";
370 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; 366 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>";
371 } 367 }
372 else if ( i == 1 ) 368 else if ( i == 1 )
373 date = "<em><font color=\"#000080\">" + day + "</font></em>" ; 369 date = "<em><font color=\"#000080\">" + day + "</font></em>" ;
374 else date = "<em><font color=\"#000080\">" + day + "</font></em>"; 370 else date = "<em><font color=\"#000080\">" + day + "</font></em>";
375 mText += "<h2>" + date + "</h2>\n"; 371 mText += "<h2>" + date + "</h2>\n";
@@ -377,13 +373,13 @@ void KOWhatsNextView::appendDay( int i, QDate eventDate )
377 mText += "<table>\n"; 373 mText += "<table>\n";
378 374
379 375
380 376
381 } else { 377 } else {
382 if ( i == 0 ) { 378 if ( i == 0 ) {
383 mText += "<table>\n"; 379 //mText += "<table>\n";
384 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; 380 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>";
385 } 381 }
386 382
387#ifdef DESKTOP_VERSION 383#ifdef DESKTOP_VERSION
388 else if ( i == 1 ) { 384 else if ( i == 1 ) {
389 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; 385 date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ;
@@ -427,24 +423,27 @@ void KOWhatsNextView::changeEventDisplay(Event *, int action)
427 default: 423 default:
428 updateView(); 424 updateView();
429 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; 425 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl;
430 } 426 }
431} 427}
432 428
433void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) 429bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable )
434{ 430{
435 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) 431 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") )
436 return; 432 return false;
437 QDateTime cdt = QDateTime::currentDateTime(); 433 QDateTime cdt = QDateTime::currentDateTime();
438 QDateTime noc; 434 QDateTime noc;
439 QString tempText; 435 QString tempText;
436 if ( appendTable && !notRed ) {
437 tempText = "<table>";
438 }
440 bool ok = true; 439 bool ok = true;
441 if ( reply ) { 440 if ( reply ) {
442 noc = ev->getNextOccurence( cdt, &ok ); 441 noc = ev->getNextOccurence( cdt, &ok );
443 if (! ok && ev->type() == "Event") 442 if (! ok && ev->type() == "Event")
444 return; 443 return false;
445 } 444 }
446 tempText += "<tr><td><b>"; 445 tempText += "<tr><td><b>";
447 if (ev->type()=="Event") { 446 if (ev->type()=="Event") {
448 if (reply) { 447 if (reply) {
449 if (!ev->doesFloat()) 448 if (!ev->doesFloat())
450 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; 449 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
@@ -483,13 +482,13 @@ void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
483 dateText += event->dtEndTimeStr(); 482 dateText += event->dtEndTimeStr();
484 if ( notRed ) 483 if ( notRed )
485 tempText += dateText; 484 tempText += dateText;
486 else { 485 else {
487 if ( end < cdt ) { 486 if ( end < cdt ) {
488 if ( !KOPrefs::instance()->mWNViewShowsPast ) 487 if ( !KOPrefs::instance()->mWNViewShowsPast )
489 return; 488 return false;
490 tempText += "<font color=\"#F00000\">" + dateText + "</font>"; 489 tempText += "<font color=\"#F00000\">" + dateText + "</font>";
491 } 490 }
492 else if ( st < cdt ) 491 else if ( st < cdt )
493 tempText += "<font color=\"#008000\">" + dateText + "</font>"; 492 tempText += "<font color=\"#008000\">" + dateText + "</font>";
494 else 493 else
495 tempText += dateText; 494 tempText += dateText;
@@ -572,12 +571,13 @@ void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
572 if ( !ev->location().isEmpty() ) 571 if ( !ev->location().isEmpty() )
573 tempText += " ("+ev->location() +")"; 572 tempText += " ("+ev->location() +")";
574 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) 573 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
575 tempText += " ["+ev->relatedTo()->summary() +"]"; 574 tempText += " ["+ev->relatedTo()->summary() +"]";
576 tempText += "</td></tr>\n"; 575 tempText += "</td></tr>\n";
577 mText += tempText; 576 mText += tempText;
577 return true;
578} 578}
579 579
580bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) 580bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
581{ 581{
582 if ( mTodos.find( ev ) != mTodos.end() ) return false; 582 if ( mTodos.find( ev ) != mTodos.end() ) return false;
583 583
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index 1118bdd..9049268 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -67,13 +67,13 @@ class KOWhatsNextView : public KOrg::BaseView
67 virtual void showDates(const QDate &start, const QDate &end); 67 virtual void showDates(const QDate &start, const QDate &end);
68 virtual void showEvents(QPtrList<Event> eventList); 68 virtual void showEvents(QPtrList<Event> eventList);
69 void updateConfig(); 69 void updateConfig();
70 void changeEventDisplay(Event *, int); 70 void changeEventDisplay(Event *, int);
71 71
72 protected: 72 protected:
73 void appendEvent(Incidence *, bool reply=false, bool notRed = true); 73 bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false);
74 bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); 74 bool appendTodo(Incidence *, QString ind = "", bool isSub = false );
75 void appendDay( int i, QDate date ); 75 void appendDay( int i, QDate date );
76 QDate mEventDate; 76 QDate mEventDate;
77 virtual void showEvent ( QShowEvent * ); 77 virtual void showEvent ( QShowEvent * );
78 virtual void hideEvent ( QHideEvent * ); 78 virtual void hideEvent ( QHideEvent * );
79 79