summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-29 12:29:53 (UTC)
committer zautrix <zautrix>2005-06-29 12:29:53 (UTC)
commit0d4d5898a32f162dca010db329e02310a14629d5 (patch) (side-by-side diff)
tree2d6e758a8a5ec64995de79a4cd1c02c89f509190 /korganizer
parent435e68d6ace30fb2121b718226e00be44971c617 (diff)
downloadkdepimpi-0d4d5898a32f162dca010db329e02310a14629d5.zip
kdepimpi-0d4d5898a32f162dca010db329e02310a14629d5.tar.gz
kdepimpi-0d4d5898a32f162dca010db329e02310a14629d5.tar.bz2
j fixes
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp53
-rw-r--r--korganizer/journalentry.h4
-rw-r--r--korganizer/kodaymatrix.cpp27
-rw-r--r--korganizer/koeventviewer.cpp3
-rw-r--r--korganizer/kojournalview.cpp22
-rw-r--r--korganizer/kojournalview.h2
-rw-r--r--korganizer/kolistview.cpp14
-rw-r--r--korganizer/searchdialog.cpp37
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
@@ -41,8 +41,9 @@
#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>
@@ -62,29 +63,19 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
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 )
@@ -110,16 +101,16 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
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 );
@@ -178,38 +169,37 @@ 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
@@ -273,10 +263,9 @@ void JournalEntry::writeJournal()
mCalendar->addJournal(mJournal);
}
mJournal->setDescription(mEditor->text());
- //qDebug("tttt%s ", mEditor->text().latin1());
-
+ mJournal->setSummary(mTitle->text());
mDirty = false;
}
void JournalEntry::flushEntry()
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index b0e9cc7..b37cabd 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -30,8 +30,9 @@
#include <libkcal/calendar.h>
class QLabel;
class KTextEdit;
+class KLineEdit;
using namespace KCal;
class JournalEntry : public QFrame {
@@ -47,9 +48,9 @@ class JournalEntry : public QFrame {
void clear();
void flushEntry();
- void setShowOnly() {showOnlyMode = true;}
+ void setShowOnly();
QSize sizeHint() const;
protected slots:
void slotSaveTemplate();
@@ -72,8 +73,9 @@ class JournalEntry : public QFrame {
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
@@ -219,16 +219,25 @@ QString KODayMatrix::getWhatsThisText( QPoint p )
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>");
}
@@ -548,9 +557,11 @@ void KODayMatrix::updateViewTimed()
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
@@ -700,8 +700,11 @@ void KOEventViewer::appendJournal(Journal *jour, int mode )
}
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
@@ -26,12 +26,18 @@
#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"
@@ -50,8 +56,23 @@ KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
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()
@@ -169,8 +190,9 @@ 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 );
}
diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h
index 0437d95..331bdfa 100644
--- a/korganizer/kojournalview.h
+++ b/korganizer/kojournalview.h
@@ -26,8 +26,9 @@
#include <korganizer/baseview.h>
#include <qlayout.h>
class JournalEntry;
+class QLabel;
/**
* This class provides a journal view.
@@ -69,8 +70,9 @@ class KOJournalView : public KOrg::BaseView
QPtrList<JournalEntry> jEntries;
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
@@ -214,12 +214,18 @@ 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,"---");
mItem->setText(3,"---");
diff --git a/korganizer/searchdialog.cpp b/korganizer/searchdialog.cpp
index 0e9f64c..72359df 100644
--- a/korganizer/searchdialog.cpp
+++ b/korganizer/searchdialog.cpp
@@ -217,8 +217,11 @@ void SearchDialog::raiseAndSelect()
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() ) {
@@ -549,20 +552,36 @@ 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;
+ }
+ }
}
}
}
if ( mMatchedEvents.count() + mMatchedJournals.count() + mMatchedTodos.count() < 1 ) {