summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/journalentry.cpp36
-rw-r--r--korganizer/journalentry.h3
-rw-r--r--korganizer/koeditorgeneral.cpp4
-rw-r--r--korganizer/kojournalview.cpp18
-rw-r--r--korganizer/kolocationbox.cpp8
-rw-r--r--korganizer/kolocationbox.h2
-rw-r--r--korganizer/koprefs.cpp2
-rw-r--r--korganizer/koprefs.h1
8 files changed, 47 insertions, 27 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 3c38f34..4751d40 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -42,8 +42,10 @@
#include <kfiledialog.h>
#include <kmessagebox.h>
#include "koprefs.h"
#include <klineedit.h>
+#include <kdialog.h>
+#include "kolocationbox.h"
#include <libkcal/journal.h>
#include <libkcal/calendarresources.h>
#include <libkcal/resourcecalendar.h>
@@ -69,14 +71,15 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
mJournal = 0;
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);
QPushButton * loadTemplate = new QPushButton( vb );
@@ -94,8 +97,9 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
loadTemplate->setPixmap (iconp ) ;
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 );
#endif
@@ -106,8 +110,10 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
mEditor->installEventFilter(this);
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()
{
@@ -176,9 +182,9 @@ 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 );
else {
@@ -194,30 +200,30 @@ void JournalEntry::setVisibleOn()
}
void JournalEntry::setShowOnly()
{
showOnlyMode = true;
- if ( mTitle->text().isEmpty() )
+ if ( mTitle->currentText().isEmpty() )
mTitle->setFocus();
else
mEditor->setFocus();
}
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
{
@@ -228,9 +234,10 @@ Journal *JournalEntry::journal() const
void JournalEntry::clear()
{
mJournal = 0;
mEditor->setText("");
- mTitle->setText("");
+ mTitle->load( KOLocationBox::SUMMARYJOURNAL );
+ mTitle->lineEdit ()->setText("");
}
bool JournalEntry::eventFilter( QObject *o, QEvent *e )
{
@@ -252,9 +259,9 @@ 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;
bool conf = KOPrefs::instance()->mConfirm;
@@ -271,12 +278,15 @@ void JournalEntry::writeJournal()
mJournal = new Journal;
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
@@ -31,8 +31,9 @@
class QLabel;
class KTextEdit;
class KLineEdit;
+class KOLocationBox;
using namespace KCal;
class JournalEntry : public QFrame {
@@ -75,9 +76,9 @@ class JournalEntry : public QFrame {
Journal *mJournal;
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
@@ -82,9 +82,9 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 );
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() );
int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
@@ -104,9 +104,9 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
headerLayout->addWidget(locationLabel,0,2);
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
@@ -49,16 +49,9 @@ KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
const char *name)
: KOrg::BaseView(calendar, parent, name)
{
mCalendar = calendar;
- QScrollView * sv = new QScrollView( this );
- 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 );
+ QHBox * vb = new QHBox ( this );
QPushButton * newJournal = new QPushButton( vb );
QPixmap icon;
if ( QApplication::desktop()->width() < 321 )
icon = SmallIcon("ko16old");
@@ -67,11 +60,18 @@ KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
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);
+ QScrollView * sv = new QScrollView( 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);
connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) );
getNewEntry();
}
diff --git a/korganizer/kolocationbox.cpp b/korganizer/kolocationbox.cpp
index 35a8123..9d5aafc 100644
--- a/korganizer/kolocationbox.cpp
+++ b/korganizer/kolocationbox.cpp
@@ -33,9 +33,9 @@
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 );
setAutoCompletion( TRUE );
@@ -60,8 +60,11 @@ void KOLocationBox::load(int what)
break; // don't disable
case SUMMARYTODO:
insertStringList( KOPrefs::instance()->mTodoSummaryUser, 0 );
break; // don't disable
+ case SUMMARYJOURNAL:
+ insertStringList( KOPrefs::instance()->mJournalSummaryUser, 0 );
+ break; // don't disable
}
}
void KOLocationBox::save(int what)
@@ -85,8 +88,11 @@ void KOLocationBox::save(int what)
break; // don't disable
case SUMMARYTODO:
KOPrefs::instance()->mTodoSummaryUser = strlist;
break; // don't disable
+ case SUMMARYJOURNAL:
+ KOPrefs::instance()->mJournalSummaryUser = strlist;
+ break; // don't disable
}
}
void KOLocationBox::clearItems(int what)
diff --git a/korganizer/kolocationbox.h b/korganizer/kolocationbox.h
index b604d33..6a42de6 100644
--- a/korganizer/kolocationbox.h
+++ b/korganizer/kolocationbox.h
@@ -35,9 +35,9 @@ class KOLocationBox : public QComboBox
public:
KOLocationBox( bool rw , QWidget *parent , int _maxItems );
virtual ~KOLocationBox();
- enum {LOCATION, SUMMARYEVENT, SUMMARYTODO};
+ enum {LOCATION, SUMMARYEVENT, SUMMARYTODO,SUMMARYJOURNAL};
public slots:
void load(int);
void save(int);
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 6337ca5..bb3d720 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -130,8 +130,9 @@ 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);
addItemBool("Auto Save",&mAutoSave,false);
@@ -362,8 +363,9 @@ void KOPrefs::setAllDefaults()
{
setCategoryDefaults();
mEventSummaryUser = getDefaultList() ;
mTodoSummaryUser = getDefaultList() ;
+ mJournalSummaryUser = getDefaultList() ;
mLocationDefaults = getLocationDefaultList();
}
void KOPrefs::setCategoryDefaults()
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 5cc9bfa..53d193b 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -314,8 +314,9 @@ class KOPrefs : public KPimPrefs
QStringList mLocationDefaults;
QStringList mEventSummaryUser;
QStringList mTodoSummaryUser;
+ QStringList mJournalSummaryUser;
bool mUseInternalAlarmNotification;
int mAlarmPlayBeeps;
int mAlarmSuspendTime;