author | zautrix <zautrix> | 2004-10-29 21:05:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-29 21:05:07 (UTC) |
commit | 3c0edb4b4c4a77b334331749dfde776911c3a3a0 (patch) (side-by-side diff) | |
tree | 89de7078a1a062c19b2f13ededd49f471c362abf | |
parent | a7e2fe5bb10af47a239b8b014a210568cc79287a (diff) | |
download | kdepimpi-3c0edb4b4c4a77b334331749dfde776911c3a3a0.zip kdepimpi-3c0edb4b4c4a77b334331749dfde776911c3a3a0.tar.gz kdepimpi-3c0edb4b4c4a77b334331749dfde776911c3a3a0.tar.bz2 |
KO WN view fix
-rw-r--r-- | kabc/addressee.cpp | 3 | ||||
-rw-r--r-- | kabc/phonenumber.cpp | 31 | ||||
-rw-r--r-- | kabc/plugins/ldap/ldapE.pro | 2 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 42 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.h | 2 |
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 @@ -315,25 +315,26 @@ void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) PhoneNumber::List::Iterator phoneItAD; for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { bool found = false; PhoneNumber::List::Iterator it; for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { if ( ( *phoneItAD ).contains( (*it) ) ) { found = true; (*it).setType( ( *phoneItAD ).type() ); (*it).setNumber( ( *phoneItAD ).number() ); break; } } - if ( isSubSet && ! found ) + // if ( isSubSet && ! found ) + if ( ! found ) // LR try this one... mData->phoneNumbers.append( *phoneItAD ); } if ( isSubSet ) { // ************* emails; t = mData->emails; tAD = ad.mData->emails; for ( iii = 0; iii < tAD.count(); ++iii) if ( !t.contains(tAD[iii] ) ) mData->emails.append( tAD[iii] ); } // ************* categories; diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index 3d82553..abb3b3b 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp @@ -80,42 +80,37 @@ bool PhoneNumber::simplifyNumber() } // make cellphone compatible void PhoneNumber::simplifyType() { if ( mType & Fax ) mType = Fax; else if ( mType & Cell ) mType = Cell; else if ( mType & Work ) mType = Work ; else if ( mType & Home ) mType = Home; else mType = Pref; } bool PhoneNumber::contains( const PhoneNumber &p ) { - QString Number; - QString Num; - uint i; - Number = mNumber.stripWhiteSpace (); - Num = ""; - for ( i = 0; i < Number.length(); ++i) { - if ( Number.at(i).isDigit() || Number.at(i) == '+'|| Number.at(i) == '*'|| Number.at(i) == '#' ) - Num += Number.at(i); - } - QString NumberR; - QString NumR; - NumberR = p.mNumber.stripWhiteSpace (); - NumR = ""; - for ( i = 0; i < NumberR.length(); ++i) { - if ( NumberR.at(i).isDigit() || NumberR.at(i) == '+'|| NumberR.at(i) == '*'|| NumberR.at(i) == '#' ) - NumR += NumberR.at(i); - } - return (Num == NumR); + PhoneNumber myself; + PhoneNumber other; + myself = *this; + other = p; + myself.simplifyNumber(); + other.simplifyNumber(); + if ( myself.number() != other.number ()) + return false; + myself.simplifyType(); + other.simplifyType(); + if ( myself.type() == other.type()) + return true; + return false; } void PhoneNumber::setId( const QString &id ) { mId = id; } QString PhoneNumber::id() const { return mId; } 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 @@ -1,21 +1,21 @@ TEMPLATE = lib CONFIG += qt warn_on release #release debug TARGET = microkabc_ldap INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include OBJECTS_DIR = obj/$(PLATFORM) MOC_DIR = moc/$(PLATFORM) DESTDIR = $(QPEDIR)/lib -LIBS += -lmicrokde -lkamicrokabc +LIBS += -lmicrokde -lmicrokabc LIBS += -L$(QPEDIR)/lib INTERFACES = \ HEADERS = \ resourceldap.h \ resourceldapconfig.h SOURCES = \ resourceldap.cpp \ resourceldapconfig.cpp diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index aa33588..2f7409d 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp @@ -61,40 +61,32 @@ KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, const char *name) : KOrg::BaseView(calendar, parent, name) { // mDateLabel = // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); // mDateLabel->setMargin(2); // mDateLabel->setAlignment(AlignCenter); setFont( KOPrefs::instance()->mWhatsNextFont ); mView = new WhatsNextTextBrowser(this); connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); QStyleSheet* stsh = mView->styleSheet(); QStyleSheetItem * style ; - style = stsh->item ("a" ); - if ( style ) { - style->setMargin(QStyleSheetItem::MarginAll,0); - } style = stsh->item ("h2" ); if ( style ) { style->setMargin(QStyleSheetItem::MarginAll,0); } style = stsh->item ("h3" ); if ( style ) { style->setMargin(QStyleSheetItem::MarginAll,0); } - style = stsh->item ("table" ); - if ( style ) { - style->setMargin(QStyleSheetItem::MarginAll,0); - } mEventViewer = 0; QBoxLayout *topLayout = new QVBoxLayout(this); // topLayout->addWidget(mDateLabel); topLayout->addWidget(mView); mTimer = new QTimer( this ); connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); } @@ -152,25 +144,25 @@ void KOWhatsNextView::restartTimer() //mTimer->start( 5000 ); } void KOWhatsNextView::updateView() { if ( mTimer->isActive() ) restartTimer(); //qDebug("KOWhatsNextView::updateView() "); // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); KIconLoader kil("korganizer"); QString ipath;// = new QString(); // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); //<big><big><strong>" + date + "</strong></big></big>\n"; - mText = "<qt><table width=\"100%\">\n"; + mText = "<table width=\"100%\">\n"; //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; #ifdef DESKTOP_VERSION mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; #else mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; #endif // mText += "<img src=\""; // mText += ipath; // mText += "\">"; mEventDate = QDate::currentDate(); #ifdef DESKTOP_VERSION mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; @@ -207,58 +199,62 @@ void KOWhatsNextView::updateView() } if (events.count() > 0) { // mText += "<p></p>"; // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); // mText += "<h2>"; //mText += " <img src=\""; //mText += ipath; //mText += "\">"; if ( ! itemAdded ) { appendDay ( iii, mEventDate ); - itemAdded = true; } + // for first day (iii == 0) + // we may have syncevents, or events in the past, which maybe should nor be diaplayed + // for that reason we cannot append <table> in appendDay () for iii == 0 + // we must append it in the first successful call of appendEvent() Event *ev = events.first(); while(ev) { //qDebug("+++++event append %s", ev->summary().latin1()); if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { - appendEvent(ev, false , iii!= 0 ); + if ( appendEvent(ev, false , iii!= 0,!itemAdded ) ) + itemAdded = true; } ev = events.next(); } //mText += "</table>\n"; } todo = todos.first(); while(todo) { if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { if ( ! itemAdded ) { appendDay ( iii, mEventDate ); itemAdded = true; } appendEvent(todo); } todo = todos.next(); } - if ( !itemAdded && iii == 0 ) { + if ( !itemAdded && iii == 0 ) { // appendDay ( iii, mEventDate ); //mText += "<table>"; // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n"; //mText +="</table>"; } - if ( itemAdded ) + if ( itemAdded ) mText += "</table>\n"; mEventDate = mEventDate.addDays( 1 ); } int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; if (todos.count() > 0 && topmostPrios > 0 ) { // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); // mText += "<h2>"; //<img src=\""; // mText += ipath; // mText += "\">"; // mText += i18n("Overdue To-Do:") + "</h2>\n"; @@ -334,62 +330,62 @@ void KOWhatsNextView::updateView() } replys++; appendEvent(to, true); } } } to = todos.next(); } } if (replys > 0 ) mText += "</table>\n"; - mText += "</td></tr>\n</table></qt>\n"; + mText += "</td></tr>\n</table>\n"; mView->setText(mText); mView->setFocus(); // QPixmap bPix = SmallIcon( "back" ); // qDebug("xxxxxxxxxxxxxxxxxxxxx "); // QWidget* test = new QWidget(); // test->setBackgroundMode(FixedPixmap ); // test->setBackgroundPixmap ( bPix ); // test->resize( 300, 400 ); // test->show(); // mView->setBackgroundMode(FixedPixmap ); // mView->setBackgroundPixmap ( bPix ); - // qDebug("%s ",mText.latin1()); + qDebug("%s ",mText.latin1()); } void KOWhatsNextView::appendDay( int i, QDate eventDate ) { QString date; QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { if ( i == 0 ) { - mText += "<table>\n"; + //mText += "<table>\n"; return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; } else if ( i == 1 ) date = "<em><font color=\"#000080\">" + day + "</font></em>" ; else date = "<em><font color=\"#000080\">" + day + "</font></em>"; mText += "<h2>" + date + "</h2>\n"; //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; mText += "<table>\n"; } else { if ( i == 0 ) { - mText += "<table>\n"; + //mText += "<table>\n"; return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; } #ifdef DESKTOP_VERSION else if ( i == 1 ) { date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; } else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; #else else if ( i == 1 ) { date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; } @@ -421,36 +417,39 @@ void KOWhatsNextView::changeEventDisplay(Event *, int action) case KOGlobals::EVENTEDITED: updateView(); break; case KOGlobals::EVENTDELETED: updateView(); break; default: updateView(); kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; } } -void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) +bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) { if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) - return; + return false; QDateTime cdt = QDateTime::currentDateTime(); QDateTime noc; QString tempText; + if ( appendTable && !notRed ) { + tempText = "<table>"; + } bool ok = true; if ( reply ) { noc = ev->getNextOccurence( cdt, &ok ); if (! ok && ev->type() == "Event") - return; + return false; } tempText += "<tr><td><b>"; if (ev->type()=="Event") { if (reply) { if (!ev->doesFloat()) tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; else tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; } else { if (!ev->doesFloat()) { Event *event = static_cast<Event *>(ev); @@ -477,25 +476,25 @@ void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) dateText = "++:++-"; else dateText = event->dtStartTimeStr() + "-"; if ( end.date() > mEventDate ) dateText += "++:++"; else dateText += event->dtEndTimeStr(); if ( notRed ) tempText += dateText; else { if ( end < cdt ) { if ( !KOPrefs::instance()->mWNViewShowsPast ) - return; + return false; tempText += "<font color=\"#F00000\">" + dateText + "</font>"; } else if ( st < cdt ) tempText += "<font color=\"#008000\">" + dateText + "</font>"; else tempText += dateText; } } else { tempText += i18n("Allday:"); @@ -566,24 +565,25 @@ void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) if ( ev->summary().length() > 0 ) tempText += ev->summary(); else tempText += i18n("-no summary-"); tempText += "</a>"; if ( KOPrefs::instance()->mWNViewShowLocation ) if ( !ev->location().isEmpty() ) tempText += " ("+ev->location() +")"; if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) tempText += " ["+ev->relatedTo()->summary() +"]"; tempText += "</td></tr>\n"; mText += tempText; + return true; } bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) { if ( mTodos.find( ev ) != mTodos.end() ) return false; mTodos.append( ev ); if ( !isSub ) mText += "<p>"; else mText += "<li>"; mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h index 1118bdd..9049268 100644 --- a/korganizer/kowhatsnextview.h +++ b/korganizer/kowhatsnextview.h @@ -61,25 +61,25 @@ class KOWhatsNextView : public KOrg::BaseView return q;} virtual void printPreview(CalPrinter *calPrinter, const QDate &, const QDate &); public slots: virtual void updateView(); virtual void showDates(const QDate &start, const QDate &end); virtual void showEvents(QPtrList<Event> eventList); void updateConfig(); void changeEventDisplay(Event *, int); protected: - void appendEvent(Incidence *, bool reply=false, bool notRed = true); + bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false); bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); void appendDay( int i, QDate date ); QDate mEventDate; virtual void showEvent ( QShowEvent * ); virtual void hideEvent ( QHideEvent * ); private slots: void showIncidence(const QString &); void restartTimer(); private: |