From 0d4d5898a32f162dca010db329e02310a14629d5 Mon Sep 17 00:00:00 2001 From: zautrix Date: Wed, 29 Jun 2005 12:29:53 +0000 Subject: j fixes --- diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 4df2005..510f4bf 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt @@ -1462,6 +1462,11 @@ { "The timezone has changed!\nShould the calendar be reloaded\nto shift the time of the events?\nPlease read Menu: Help->FAQ:\n"How do I change the timezone?"\nas well!","Die Zeitzone wurde geändert!\nSollen die Kalender neu geladen\nwerden num die Zeiten\nder Termine zu ändern?\nBitte lesen Sie auch\nMenu: Help->FAQ:\n"How do I change the timezone?"" }, { "Reload","Neu laden" }, { "Timezone settings","Zeitzoneneinstellung" }, +{ " Title: "," Titel: " }, +{ "","" }, +{ "","" }, +{ "","" }, +{ "","" }, { "","" }, { "","" }, { "","" }, \ No newline at end of file diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 0b923ad..05bfd31 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -42,6 +42,7 @@ #include #include #include "koprefs.h" +#include #include #include @@ -63,27 +64,17 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : mDirty = false; QHBox * vb = new QHBox ( this ); - QPushButton * newJournal = new QPushButton( vb ); QIconSet icon; - if ( QApplication::desktop()->width() < 321 ) - icon = SmallIcon("ko16old"); - else - icon = SmallIcon("ko24old"); - newJournal->setIconSet (icon ) ; - int size = newJournal->sizeHint().height(); - newJournal->setFixedSize( size, size ); - QPushButton * toggleJournal = new QPushButton( vb ); icon = SmallIcon("1updownarrow"); toggleJournal->setIconSet (icon ) ; - //int size = toggleJournal->sizeHint().height(); + int size = toggleJournal->sizeHint().height(); toggleJournal->setFixedSize( size * 2 /3 , size ); - - - + new QLabel(i18n(" Title: "),vb); + mTitle = new KLineEdit ( vb ); mTitleLabel = new QLabel(i18n("Title"),vb); - mTitleLabel->setMargin(2); + mTitleLabel->setMargin(0); mTitleLabel->setAlignment(AlignCenter); QPushButton * loadTemplate = new QPushButton( vb ); QPushButton * saveTemplate = new QPushButton( vb ); @@ -111,14 +102,14 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : topLayout->addWidget(mEditor); mEditor->installEventFilter(this); connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); + connect( mTitle, SIGNAL( textChanged ( const QString & ) ), this , SLOT( setDirty() ) ); connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); - connect( newJournal, SIGNAL( clicked() ), this , SIGNAL( newJournal() ) ); connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); } JournalEntry::~JournalEntry() { - qDebug("JournalEntry::~JournalEntry() "); + //qDebug("JournalEntry::~JournalEntry() "); } QSize JournalEntry::sizeHint() const { @@ -179,36 +170,35 @@ void JournalEntry::setDate(const QDate &date) mDate = date; writeJournal(); int id = mCalendar->defaultCalendar(); - if ( id == 1 ) { - mTitleLabel->setText(KGlobal::locale()->formatDate(date)); - } else { - QString calname = KOPrefs::instance()->getCalendar( id )->mName; - mTitleLabel->setText( KGlobal::locale()->formatDate(mDate,true) + " (" + calname +")"); - } + QString calname = KOPrefs::instance()->getCalendar( id )->mName; + mTitleLabel->setText( " (" + calname +")"); } void JournalEntry::toggleShowJournal() { + flushEntry(); if ( showOnlyMode ) emit showJournalOnly( 0 ); else emit showJournalOnly( mJournal ); } - +void JournalEntry::setShowOnly() +{ + showOnlyMode = true; + mEditor->setFocus(); +} void JournalEntry::setJournal(Journal *journal) { writeJournal(); mJournal = journal; - + mTitle->setText(mJournal->summary()); mEditor->setText(mJournal->description()); int id = mJournal->calID(); - if ( id > 1 ) { - QString calname = KOPrefs::instance()->getCalendar( id )->mName; - mTitleLabel->setText( KGlobal::locale()->formatDate(mDate,true) + " (" + calname +")"); - } else { - mTitleLabel->setText(KGlobal::locale()->formatDate(mDate)); - } + + QString calname = KOPrefs::instance()->getCalendar( id )->mName; + mTitleLabel->setText( " (" + calname +")"); + mDirty = false; } @@ -274,8 +264,7 @@ void JournalEntry::writeJournal() } mJournal->setDescription(mEditor->text()); - //qDebug("tttt%s ", mEditor->text().latin1()); - + mJournal->setSummary(mTitle->text()); mDirty = false; } diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h index b0e9cc7..b37cabd 100644 --- a/korganizer/journalentry.h +++ b/korganizer/journalentry.h @@ -31,6 +31,7 @@ class QLabel; class KTextEdit; +class KLineEdit; using namespace KCal; @@ -48,7 +49,7 @@ class JournalEntry : public QFrame { void clear(); void flushEntry(); - void setShowOnly() {showOnlyMode = true;} + void setShowOnly(); QSize sizeHint() const; protected slots: @@ -73,6 +74,7 @@ class JournalEntry : public QFrame { QDate mDate; void keyPressEvent ( QKeyEvent * ) ; QLabel *mTitleLabel; + KLineEdit * mTitle; KTextEdit *mEditor; int heiHint; diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 3468657..067c34c 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -220,14 +220,23 @@ QString KODayMatrix::getWhatsThisText( QPoint p ) } } if (KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { - Journal *j = mCalendar->journal( mDate ); - if ( j ) { - QString mToolTipText = j->description().left(100); - if ( j->description().length() > 100 ) - mToolTipText += " ..."; - mToolTipText = deTag( mToolTipText); + QPtrList j_list = mCalendar->journals4Date( mDate ); + Journal *j = j_list.first(); + while ( j ) { + QString mToolTipText; + if ( !j->summary().isEmpty() ) { + mToolTipText = j->summary().left(30); + if ( j->summary().length() > 30 ) + mToolTipText += " ..."; + } else { + mToolTipText = j->description().left(25); + if ( j->description().length() > 25 ) + mToolTipText += " ..."; + mToolTipText = deTag( mToolTipText); + } mToolTipText = "" + i18n("Journal: ") + ""+ mToolTipText; - mToolTip.append( mToolTipText ); + mToolTip.append( mToolTipText ); + j = j_list.next(); } } return ""+KGlobal::locale()->formatDate(days[tmp]) + "
" + mToolTip.join("
"); @@ -549,7 +558,9 @@ void KODayMatrix::updateViewTimed() pDays.setBit(i); if ( !holiStr.isEmpty() ) holiStr += "\n"; - holiStr += i18n("Journal"); + holiStr += i18n("Journal: ")+todo->summary().left(25); + if ( todo->summary().length() > 25 ) + holiStr +="..."; bDays.setBit(i); mHolidays[i] =holiStr ; eDays.setBit(i); diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 6315827..dcbb99f 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -701,6 +701,9 @@ void KOEventViewer::appendJournal(Journal *jour, int mode ) topLevelWidget()->setCaption("Journal Viewer"); mText.append(i18n("

%1

").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer))); addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) ); + if (!jour->summary().isEmpty()) { + addTag("p",i18n(" Title: ") + deTag(jour->summary())); + } if (!jour->description().isEmpty()) { addTag("p",deTag(jour->description())); } diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index 9e354d3..4fc9013 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp @@ -27,10 +27,16 @@ #include #include #include +#include +#include +#include +#include +#include #include #include #include "koprefs.h" +#include #include @@ -51,6 +57,21 @@ KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, sv->addChild(parWid); sv->setResizePolicy( QScrollView:: AutoOneFit ); mTopLayout = new QVBoxLayout(parWid); + QHBox * vb = new QHBox ( parWid ); + QPushButton * newJournal = new QPushButton( vb ); + QIconSet icon; + if ( QApplication::desktop()->width() < 321 ) + icon = SmallIcon("ko16old"); + else + icon = SmallIcon("ko24old"); + newJournal->setIconSet (icon ) ; + int size = newJournal->sizeHint().height(); + newJournal->setFixedSize( size, size ); + mDateLabel = new QLabel ( vb ); + mTopLayout->addWidget( vb ); + mDateLabel->setMargin(2); + mDateLabel->setAlignment(AlignCenter); + connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) ); getNewEntry(); } @@ -170,6 +191,7 @@ void KOJournalView::showList(QPtrList jl) void KOJournalView::showDates(const QDate &start, const QDate &) { mDate = start; + mDateLabel-> setText(KGlobal::locale()->formatDate(mDate)); QPtrList jl = calendar()->journals4Date( start ); showList( jl ); } diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h index 0437d95..331bdfa 100644 --- a/korganizer/kojournalview.h +++ b/korganizer/kojournalview.h @@ -27,6 +27,7 @@ #include class JournalEntry; +class QLabel; /** * This class provides a journal view. @@ -70,6 +71,7 @@ class KOJournalView : public KOrg::BaseView void keyPressEvent ( QKeyEvent * ) ; QBoxLayout *mTopLayout; QWidget *parWid; + QLabel * mDateLabel; QDate mDate; }; diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 22d9ac0..0c1ac7a 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -215,10 +215,16 @@ bool ListItemVisitor::visit(Todo *t) bool ListItemVisitor::visit(Journal * j) { - QString des = j->description().left(30); - des = des.simplifyWhiteSpace (); - des.replace (QRegExp ("\\n"),"" ); - des.replace (QRegExp ("\\r"),"" ); + + QString des; + if ( !j->summary().isEmpty() ) { + des = j->summary(); + } else { + des = j->description().left(30); + des = des.simplifyWhiteSpace (); + des.replace (QRegExp ("\\n"),"" ); + des.replace (QRegExp ("\\r"),"" ); + } mItem->setText(0,i18n("Journal: ")+des.left(25)); mItem->setText(1,j->dtStartDateStr()); mItem->setText(2,"---"); diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 0e9f64c..72359df 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp @@ -218,6 +218,9 @@ void SearchDialog::raiseAndSelect() mSearchJournal->setChecked( true ); mSearchTodo->setChecked( false ); mSearchEvent->setChecked( false ); + mSummaryCheck->setChecked( true ); + mDescriptionCheck->setChecked( true ); + } } else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { @@ -550,18 +553,34 @@ void SearchDialog::search(const QRegExp &re) for(journ=journals.first();journ;journ=journals.next()) { if ( journ->dtStart().date() <= mEndDate->date() &&journ->dtStart().date() >= mStartDate->date()) { + if (mDescriptionCheck->isChecked()) { #if QT_VERSION >= 0x030000 - if (re.search(journ->description()) != -1) + if (re.search(journ->description()) != -1) #else - if (re.match(journ->description()) != -1) + if (re.match(journ->description()) != -1) #endif - { - if ( mSubItems->isChecked() ) - mMatchedJournals.remove(journ); - else if (!mMatchedJournals.contains( journ )) - mMatchedJournals.append(journ); - continue; - } + { + if ( mSubItems->isChecked() ) + mMatchedJournals.remove(journ); + else if (!mMatchedJournals.contains( journ )) + mMatchedJournals.append(journ); + continue; + } + } + if (mSummaryCheck->isChecked()) { +#if QT_VERSION >= 0x030000 + if (re.search(journ->summary()) != -1) +#else + if (re.match(journ->summary()) != -1) +#endif + { + if ( mSubItems->isChecked() ) + mMatchedJournals.remove(journ); + else if (!mMatchedJournals.contains( journ )) + mMatchedJournals.append(journ); + continue; + } + } } } } -- cgit v0.9.0.2