-rw-r--r-- | korganizer/journalentry.cpp | 53 | ||||
-rw-r--r-- | korganizer/journalentry.h | 4 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 27 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 3 | ||||
-rw-r--r-- | korganizer/kojournalview.cpp | 22 | ||||
-rw-r--r-- | korganizer/kojournalview.h | 2 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 14 | ||||
-rw-r--r-- | korganizer/searchdialog.cpp | 37 |
8 files changed, 108 insertions, 54 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 0b923ad..05bfd31 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -39,12 +39,13 @@ #include <kglobal.h> #include <klocale.h> #include <ktextedit.h> #include <kfiledialog.h> #include <kmessagebox.h> #include "koprefs.h" +#include <klineedit.h> #include <libkcal/journal.h> #include <libkcal/calendarresources.h> #include <libkcal/resourcecalendar.h> #include <kresources/resourceselectdialog.h> @@ -60,33 +61,23 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : showOnlyMode = false; mCalendar = calendar; mJournal = 0; 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 ); if ( QApplication::desktop()->width() < 321 ) icon = SmallIcon("fileexport16"); else @@ -108,20 +99,20 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : mEditor->setWordWrap( KTextEdit::WidgetWidth ); QBoxLayout *topLayout = new QVBoxLayout(this); topLayout->addWidget(vb); 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 { return QSize ( 240, heiHint ); } void JournalEntry::slotSaveTemplate() @@ -176,42 +167,41 @@ void JournalEntry::slotLoadTemplate() void JournalEntry::setDate(const QDate &date) { showOnlyMode = false; 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; } Journal *JournalEntry::journal() const { return mJournal; @@ -271,14 +261,13 @@ void JournalEntry::writeJournal() mJournal = new Journal; mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); mCalendar->addJournal(mJournal); } mJournal->setDescription(mEditor->text()); - //qDebug("tttt%s ", mEditor->text().latin1()); - + mJournal->setSummary(mTitle->text()); mDirty = false; } void JournalEntry::flushEntry() { if (!mDirty) return; diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h index b0e9cc7..b37cabd 100644 --- a/korganizer/journalentry.h +++ b/korganizer/journalentry.h @@ -28,12 +28,13 @@ #include <qframe.h> #include <libkcal/calendar.h> class QLabel; class KTextEdit; +class KLineEdit; using namespace KCal; class JournalEntry : public QFrame { Q_OBJECT public: @@ -45,13 +46,13 @@ class JournalEntry : public QFrame { void setDate(const QDate &); void clear(); void flushEntry(); - void setShowOnly() {showOnlyMode = true;} + void setShowOnly(); QSize sizeHint() const; protected slots: void slotSaveTemplate(); void slotLoadTemplate(); void setDirty(); @@ -70,12 +71,13 @@ class JournalEntry : public QFrame { bool showOnlyMode; Calendar *mCalendar; Journal *mJournal; QDate mDate; void keyPressEvent ( QKeyEvent * ) ; QLabel *mTitleLabel; + KLineEdit * mTitle; KTextEdit *mEditor; int heiHint; bool mDirty; }; diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 3468657..067c34c 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -217,20 +217,29 @@ QString KODayMatrix::getWhatsThisText( QPoint p ) mToolTipText = deTag( mToolTipText); mToolTipText = "<b>" + i18n("Todo: ") + "</b>"+ mToolTipText; mToolTip.append( mToolTipText ); } } 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<Journal> 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 = "<b>" + i18n("Journal: ") + "</b>"+ mToolTipText; - mToolTip.append( mToolTipText ); + mToolTip.append( mToolTipText ); + j = j_list.next(); } } return "<b>"+KGlobal::locale()->formatDate(days[tmp]) + "</b><br>" + mToolTip.join("<br>"); } @@ -546,13 +555,15 @@ void KODayMatrix::updateViewTimed() if ( day >= 0 && day < timeSpan + 1) { int i = day; QString holiStr = mHolidays[i]; 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 @@ -698,12 +698,15 @@ void KOEventViewer::appendJournal(Journal *jour, int mode ) addTag("h2",i18n( "Remote: " ) +i18n("Journal from: ")); } } topLevelWidget()->setCaption("Journal Viewer"); mText.append(i18n("<h3> %1 </h3> ").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())); } setText(mText); } diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index 9e354d3..4fc9013 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp @@ -24,16 +24,22 @@ // // View of Journal entries #include <qlayout.h> #include <qscrollview.h> #include <qpopupmenu.h> +#include <qhbox.h> +#include <qpushbutton.h> +#include <qlabel.h> +#include <qpushbutton.h> +#include <qapplication.h> #include <klocale.h> #include <kdebug.h> #include "koprefs.h" +#include <kglobal.h> #include <libkcal/calendar.h> #include "journalentry.h" #include "kojournalview.h" @@ -48,12 +54,27 @@ KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, QHBoxLayout * hbl = new QHBoxLayout( this ); hbl->addWidget( sv ); parWid = new QWidget( sv->viewport() ); 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(); } KOJournalView::~KOJournalView() { } @@ -167,12 +188,13 @@ void KOJournalView::showList(QPtrList<Journal> jl) } } void KOJournalView::showDates(const QDate &start, const QDate &) { mDate = start; + mDateLabel-> setText(KGlobal::locale()->formatDate(mDate)); QPtrList<Journal> jl = calendar()->journals4Date( start ); showList( jl ); } void KOJournalView::showEvents(QPtrList<Event>) { diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h index 0437d95..331bdfa 100644 --- a/korganizer/kojournalview.h +++ b/korganizer/kojournalview.h @@ -24,12 +24,13 @@ #define _KOJOURNALVIEW_H #include <korganizer/baseview.h> #include <qlayout.h> class JournalEntry; +class QLabel; /** * This class provides a journal view. * @short View for Journal components. * @author Cornelius Schumacher <schumacher@kde.org> @@ -67,11 +68,12 @@ class KOJournalView : public KOrg::BaseView Calendar *mCalendar; JournalEntry* getNewEntry(); QPtrList<JournalEntry> jEntries; void keyPressEvent ( QKeyEvent * ) ; QBoxLayout *mTopLayout; QWidget *parWid; + QLabel * mDateLabel; QDate mDate; }; #endif diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 22d9ac0..0c1ac7a 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -212,16 +212,22 @@ bool ListItemVisitor::visit(Todo *t) } return true; } 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,"---"); mItem->setText(3,"---"); mItem->setText(4,"---"); mItem->setText(5,"---"); diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp index 0e9f64c..72359df 100644 --- a/korganizer/searchdialog.cpp +++ b/korganizer/searchdialog.cpp @@ -215,12 +215,15 @@ void SearchDialog::raiseAndSelect() if ( newState != currentState ) { if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_J_VIEW ) { if ( ! mSearchJournal->isChecked() ) { mSearchJournal->setChecked( true ); mSearchTodo->setChecked( false ); mSearchEvent->setChecked( false ); + mSummaryCheck->setChecked( true ); + mDescriptionCheck->setChecked( true ); + } } else if ( KOPrefs::instance()->mCurrentDisplayedView == VIEW_T_VIEW ) { if ( ! mSearchTodo->isChecked() ) { mSearchTodo->setChecked( true ); mSearchJournal->setChecked( false ); @@ -547,24 +550,40 @@ void SearchDialog::search(const QRegExp &re) if ( ! mRefineItems->isChecked() ) journals = mCalendar->journals(); Journal* journ; 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; + } + } } } } if ( mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() < 1 ) { qDebug("count %d ", mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() ); if ( mRefineItems->isChecked() ) |