-rw-r--r-- | korganizer/journalentry.cpp | 36 | ||||
-rw-r--r-- | korganizer/journalentry.h | 3 | ||||
-rw-r--r-- | korganizer/koeditorgeneral.cpp | 4 | ||||
-rw-r--r-- | korganizer/kojournalview.cpp | 36 | ||||
-rw-r--r-- | korganizer/kolocationbox.cpp | 8 | ||||
-rw-r--r-- | korganizer/kolocationbox.h | 2 | ||||
-rw-r--r-- | korganizer/koprefs.cpp | 2 | ||||
-rw-r--r-- | korganizer/koprefs.h | 1 |
8 files changed, 56 insertions, 36 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 3c38f34..4751d40 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -43,6 +43,8 @@ #include <kmessagebox.h> #include "koprefs.h" #include <klineedit.h> +#include <kdialog.h> +#include "kolocationbox.h" #include <libkcal/journal.h> #include <libkcal/calendarresources.h> @@ -70,12 +72,13 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : visibleMode = true; QHBox * vb = new QHBox ( this ); QPixmap iconp; - + vb->setMargin ( KDialog::marginHint()-1 ); QPushButton * toggleJournal = new QPushButton( vb ); iconp = SmallIcon("1updownarrow"); toggleJournal->setPixmap (iconp ) ; new QLabel(" "+i18n("Title: "),vb); - mTitle = new KLineEdit ( vb ); + mTitle = new KOLocationBox(TRUE, vb, 30); + mTitle->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding ,QSizePolicy::Fixed ,FALSE) ); mTitleLabel = new QLabel(i18n("Title"),vb); mTitleLabel->setMargin(0); mTitleLabel->setAlignment(AlignCenter); @@ -95,6 +98,7 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : loadTemplate->setFixedSize( size, size ); saveTemplate->setFixedSize( size, size ); toggleJournal->setFixedSize( size , size ); + mTitle->setMaximumHeight( size+4); mEditor = new KTextEdit(this); #ifndef DESKTOP_VERSION QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); @@ -107,6 +111,8 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); + mTitle->load( KOLocationBox::SUMMARYJOURNAL ); + mTitle->lineEdit ()->setText(""); } JournalEntry::~JournalEntry() @@ -177,7 +183,7 @@ void JournalEntry::setDate(const QDate &date) void JournalEntry::toggleShowJournal() { - if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty()) + if (!mEditor->text().isEmpty() || !mTitle->currentText ().isEmpty()) flushEntry(); if ( showOnlyMode ) emit showJournalOnly( 0 ); @@ -195,7 +201,7 @@ void JournalEntry::setVisibleOn() void JournalEntry::setShowOnly() { showOnlyMode = true; - if ( mTitle->text().isEmpty() ) + if ( mTitle->currentText().isEmpty() ) mTitle->setFocus(); else mEditor->setFocus(); @@ -203,20 +209,20 @@ void JournalEntry::setShowOnly() void JournalEntry::setJournal(Journal *journal) { writeJournal(); + mTitle->load( KOLocationBox::SUMMARYJOURNAL ); mJournal = journal; if ( journal->isReadOnly() ) - mTitle->setText(mJournal->summary()+" ("+i18n("readonly")+")"); + mTitle->lineEdit ()->setText(mJournal->summary()+" ("+i18n("readonly")+")"); else - mTitle->setText(mJournal->summary()); + mTitle->lineEdit ()->setText(mJournal->summary()); mEditor->setText(mJournal->description()); - mTitle->setReadOnly (journal->isReadOnly() ); + mTitle->setEnabled (!journal->isReadOnly() ); mEditor->setReadOnly ( journal->isReadOnly() ); int id = mJournal->calID(); QString calname = KOPrefs::instance()->getCalendar( id )->mName; mTitleLabel->setText( " (" + calname +")"); - } Journal *JournalEntry::journal() const @@ -229,7 +235,8 @@ void JournalEntry::clear() { mJournal = 0; mEditor->setText(""); - mTitle->setText(""); + mTitle->load( KOLocationBox::SUMMARYJOURNAL ); + mTitle->lineEdit ()->setText(""); } bool JournalEntry::eventFilter( QObject *o, QEvent *e ) @@ -253,7 +260,7 @@ bool JournalEntry::eventFilter( QObject *o, QEvent *e ) void JournalEntry::writeJournal() { if ( !visibleMode ) return; - if (mEditor->text().isEmpty() && mTitle->text().isEmpty()) { + if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) { if ( mJournal ) { Journal* j = mJournal; mJournal = 0; @@ -272,10 +279,13 @@ void JournalEntry::writeJournal() mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); mCalendar->addJournal(mJournal); } - if ( mJournal->description() != mEditor->text() ) + if ( mJournal->description() != mEditor->text() ) { mJournal->setDescription(mEditor->text()); - if ( mJournal->summary() != mTitle->text() ) - mJournal->setSummary(mTitle->text()); + } + if ( mJournal->summary() != mTitle->currentText() ) { + mJournal->setSummary(mTitle->currentText()); + mTitle->save(KOLocationBox::SUMMARYJOURNAL); + } } void JournalEntry::flushEntry() diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h index cc9b5ef..fb19fb1 100644 --- a/korganizer/journalentry.h +++ b/korganizer/journalentry.h @@ -32,6 +32,7 @@ class QLabel; class KTextEdit; class KLineEdit; +class KOLocationBox; using namespace KCal; @@ -76,7 +77,7 @@ class JournalEntry : public QFrame { QDate mDate; void keyPressEvent ( QKeyEvent * ) ; QLabel *mTitleLabel; - KLineEdit * mTitle; + KOLocationBox * mTitle; KTextEdit *mEditor; int heiHint; }; diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp index 407a5d5..fd50b05 100644 --- a/korganizer/koeditorgeneral.cpp +++ b/korganizer/koeditorgeneral.cpp @@ -83,7 +83,7 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); headerLayout->addWidget(summaryLabel,0,0); - mSummaryEdit = new KOLocationBox(TRUE,parent, 10); + mSummaryEdit = new KOLocationBox(TRUE,parent, 50); mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); @@ -105,7 +105,7 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) else headerLayout->addWidget(locationLabel,1,0); - mLocationEdit = new KOLocationBox(TRUE,parent,10); + mLocationEdit = new KOLocationBox(TRUE,parent,30); mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) mLocationEdit->setMaximumHeight( hei + 6); diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp index 6fa9b23..9b0e748 100644 --- a/korganizer/kojournalview.cpp +++ b/korganizer/kojournalview.cpp @@ -50,29 +50,29 @@ KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, : KOrg::BaseView(calendar, parent, name) { mCalendar = calendar; + QHBox * vb = new QHBox ( this ); + QPushButton * newJournal = new QPushButton( vb ); + QPixmap icon; + if ( QApplication::desktop()->width() < 321 ) + icon = SmallIcon("ko16old"); + else + icon = SmallIcon("ko24old"); + newJournal->setPixmap (icon ) ; + int size = newJournal->sizeHint().height(); + newJournal->setFixedSize( size, size ); + mDateLabel = new QLabel ( vb ); + mDateLabel->setMargin(1); + mDateLabel->setAlignment(AlignCenter); QScrollView * sv = new QScrollView( this ); - QHBoxLayout * hbl = new QHBoxLayout( this ); + QVBoxLayout * hbl = new QVBoxLayout( this ); + hbl->addWidget( vb ); 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 ); - QPixmap icon; - if ( QApplication::desktop()->width() < 321 ) - icon = SmallIcon("ko16old"); - else - icon = SmallIcon("ko24old"); - newJournal->setPixmap (icon ) ; - int size = newJournal->sizeHint().height(); - newJournal->setFixedSize( size, size ); - mDateLabel = new QLabel ( vb ); - mTopLayout->addWidget( vb ); - mDateLabel->setMargin(1); - mDateLabel->setAlignment(AlignCenter); - connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) ); - getNewEntry(); + mTopLayout = new QVBoxLayout(parWid); + connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) ); + getNewEntry(); } KOJournalView::~KOJournalView() diff --git a/korganizer/kolocationbox.cpp b/korganizer/kolocationbox.cpp index 35a8123..9d5aafc 100644 --- a/korganizer/kolocationbox.cpp +++ b/korganizer/kolocationbox.cpp @@ -34,7 +34,7 @@ KOLocationBox::KOLocationBox( bool rw , QWidget *parent , int _maxItems) : QComboBox( rw , parent ) { maxItems = _maxItems; - maxItems = 50; // sorry - hack from me to set maxitems globally to 30 + //maxItems = 50; // sorry - hack from me to set maxitems globally to 30 setInsertionPolicy(AtTop); setDuplicatesEnabled( FALSE ); setMaxCount( maxItems ); @@ -61,6 +61,9 @@ void KOLocationBox::load(int what) case SUMMARYTODO: insertStringList( KOPrefs::instance()->mTodoSummaryUser, 0 ); break; // don't disable + case SUMMARYJOURNAL: + insertStringList( KOPrefs::instance()->mJournalSummaryUser, 0 ); + break; // don't disable } } @@ -86,6 +89,9 @@ void KOLocationBox::save(int what) case SUMMARYTODO: KOPrefs::instance()->mTodoSummaryUser = strlist; break; // don't disable + case SUMMARYJOURNAL: + KOPrefs::instance()->mJournalSummaryUser = strlist; + break; // don't disable } } diff --git a/korganizer/kolocationbox.h b/korganizer/kolocationbox.h index b604d33..6a42de6 100644 --- a/korganizer/kolocationbox.h +++ b/korganizer/kolocationbox.h @@ -36,7 +36,7 @@ class KOLocationBox : public QComboBox KOLocationBox( bool rw , QWidget *parent , int _maxItems ); virtual ~KOLocationBox(); - enum {LOCATION, SUMMARYEVENT, SUMMARYTODO}; + enum {LOCATION, SUMMARYEVENT, SUMMARYTODO,SUMMARYJOURNAL}; public slots: void load(int); diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 6337ca5..bb3d720 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -131,6 +131,7 @@ KOPrefs::KOPrefs() : addItemStringList("LocationDefaults",&mLocationDefaults ); addItemStringList("EventSummary User",&mEventSummaryUser); addItemStringList("TodoSummary User",&mTodoSummaryUser); + addItemStringList("JournalSummary User",&mJournalSummaryUser); addItemBool("Enable Group Scheduling",&mEnableGroupScheduling,false); addItemBool("Enable Project View",&mEnableProjectView,false); @@ -363,6 +364,7 @@ void KOPrefs::setAllDefaults() setCategoryDefaults(); mEventSummaryUser = getDefaultList() ; mTodoSummaryUser = getDefaultList() ; + mJournalSummaryUser = getDefaultList() ; mLocationDefaults = getLocationDefaultList(); } diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h index 5cc9bfa..53d193b 100644 --- a/korganizer/koprefs.h +++ b/korganizer/koprefs.h @@ -315,6 +315,7 @@ class KOPrefs : public KPimPrefs QStringList mLocationDefaults; QStringList mEventSummaryUser; QStringList mTodoSummaryUser; + QStringList mJournalSummaryUser; bool mUseInternalAlarmNotification; int mAlarmPlayBeeps; |