summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (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
@@ -38,16 +38,18 @@
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
#include <ktextedit.h>
#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>
#include <kresources/resourceselectdialog.h>
#include "journalentry.h"
//#include "journalentry.moc"
@@ -65,22 +67,23 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
heiHint = heiHint / fac;
showOnlyMode = false;
mCalendar = calendar;
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 );
QPushButton * saveTemplate = new QPushButton( vb );
if ( QApplication::desktop()->width() < 321 )
iconp = SmallIcon("fileexport16");
else
@@ -90,28 +93,31 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
if ( QApplication::desktop()->width() < 321 )
iconp = SmallIcon("fileimport16");
else
iconp = SmallIcon("fileimport");
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
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( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) );
+ mTitle->load( KOLocationBox::SUMMARYJOURNAL );
+ mTitle->lineEdit ()->setText("");
}
JournalEntry::~JournalEntry()
{
//qDebug("JournalEntry::~JournalEntry() ");
}
QSize JournalEntry::sizeHint() const
{
@@ -172,17 +178,17 @@ void JournalEntry::setDate(const QDate &date)
mDate = date;
int id = mCalendar->defaultCalendar();
QString calname = KOPrefs::instance()->getCalendar( id )->mName;
mTitleLabel->setText( " (" + calname +")");
}
void JournalEntry::toggleShowJournal()
{
- if (!mEditor->text().isEmpty() || !mTitle->text().isEmpty())
+ if (!mEditor->text().isEmpty() || !mTitle->currentText ().isEmpty())
flushEntry();
if ( showOnlyMode )
emit showJournalOnly( 0 );
else {
// we have to protect mJournal from deleting if mJournal has empty text
visibleMode = false; // set to true via :setShowOnly()
emit showJournalOnly( mJournal );
//QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) );
@@ -190,51 +196,52 @@ void JournalEntry::toggleShowJournal()
}
void JournalEntry::setVisibleOn()
{
visibleMode = true;
}
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
{
return mJournal;
}
void JournalEntry::clear()
{
mJournal = 0;
mEditor->setText("");
- mTitle->setText("");
+ mTitle->load( KOLocationBox::SUMMARYJOURNAL );
+ mTitle->lineEdit ()->setText("");
}
bool JournalEntry::eventFilter( QObject *o, QEvent *e )
{
// kdDebug() << "JournalEntry::event received " << e->type() << endl;
if ( e->type() == QEvent::FocusOut ) {
writeJournal();
@@ -248,17 +255,17 @@ bool JournalEntry::eventFilter( QObject *o, QEvent *e )
}
return QFrame::eventFilter( o, e ); // standard event processing
}
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;
KOPrefs::instance()->mConfirm = false;
emit deleteJournal(j);
KOPrefs::instance()->mConfirm = conf;
}
@@ -267,20 +274,23 @@ void JournalEntry::writeJournal()
// kdDebug() << "JournalEntry::writeJournal()..." << endl;
if (!mJournal) {
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()
{
writeJournal();
}
void JournalEntry::keyPressEvent ( QKeyEvent * e )
{
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index cc9b5ef..fb19fb1 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -27,16 +27,17 @@
#include <qframe.h>
#include <libkcal/calendar.h>
class QLabel;
class KTextEdit;
class KLineEdit;
+class KOLocationBox;
using namespace KCal;
class JournalEntry : public QFrame {
Q_OBJECT
public:
JournalEntry(Calendar *,QWidget *parent);
virtual ~JournalEntry();
@@ -71,14 +72,14 @@ class JournalEntry : public QFrame {
private:
bool visibleMode;
bool showOnlyMode;
Calendar *mCalendar;
Journal *mJournal;
QDate mDate;
void keyPressEvent ( QKeyEvent * ) ;
QLabel *mTitleLabel;
- KLineEdit * mTitle;
+ KOLocationBox * mTitle;
KTextEdit *mEditor;
int heiHint;
};
#endif
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index 407a5d5..fd50b05 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -78,17 +78,17 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
#endif
// 1 on pda
// 11 on desktop
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;
if ( QApplication::desktop()->width() > 320 )
mSummaryEdit->setMaximumHeight( hei +6 );
//qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
// SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
@@ -100,17 +100,17 @@ void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
if ( QApplication::desktop()->height() < 320 )
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);
// mLocationEdit = new QLineEdit(parent);
connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
mCalendarBox = new QComboBox ( parent );
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index 6fa9b23..9b0e748 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -45,37 +45,37 @@
#include "kojournalview.h"
using namespace KOrg;
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");
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);
+ 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();
}
KOJournalView::~KOJournalView()
{
}
diff --git a/korganizer/kolocationbox.cpp b/korganizer/kolocationbox.cpp
index 35a8123..9d5aafc 100644
--- a/korganizer/kolocationbox.cpp
+++ b/korganizer/kolocationbox.cpp
@@ -29,17 +29,17 @@
#include <qlineedit.h>
#include <qapplication.h>
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 );
}
KOLocationBox::~KOLocationBox()
@@ -56,16 +56,19 @@ void KOLocationBox::load(int what)
// insertStringList( KOPrefs::instance()->mLocationUserDefaults, 0 );
break; // don't disable
case SUMMARYEVENT:
insertStringList( KOPrefs::instance()->mEventSummaryUser, 0 );
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)
{
strlist.clear();
for( int l = 0; l < count() ; l++ ) {
strlist << text( l );
@@ -81,16 +84,19 @@ void KOLocationBox::save(int what)
// KOPrefs::instance()->mLocationUserDefaults = strlist;
break; // don't disable
case SUMMARYEVENT:
KOPrefs::instance()->mEventSummaryUser = strlist;
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)
{
clear();
save(what);
}
diff --git a/korganizer/kolocationbox.h b/korganizer/kolocationbox.h
index b604d33..6a42de6 100644
--- a/korganizer/kolocationbox.h
+++ b/korganizer/kolocationbox.h
@@ -31,17 +31,17 @@
#include "koprefs.h"
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);
void clearItems(int); // clear listbox and config rc items
protected:
// void focusOutEvent( QFocusEvent * );
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index 6337ca5..bb3d720 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -126,16 +126,17 @@ KOPrefs::KOPrefs() :
addItemBool("ShowCompletedTodo",&mShowCompletedTodo,true);
addItemInt("AllDay Size",&mAllDaySize,28);
QString defAlarm = KGlobal::iconLoader()->iconPath()+"koalarm.wav";
addItemString("DefaultAlarmFile",&mDefaultAlarmFile,defAlarm );
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);
addItemInt("Auto Save Interval",&mAutoSaveInterval,3);
addItemBool("Confirm Deletes",&mConfirm,true);
addItemString("Archive File",&mArchiveFile);
addItemString("Html Export File",&mHtmlExportFile,
@@ -358,16 +359,17 @@ void KOPrefs::setTimeZoneIdDefault()
;
}
void KOPrefs::setAllDefaults()
{
setCategoryDefaults();
mEventSummaryUser = getDefaultList() ;
mTodoSummaryUser = getDefaultList() ;
+ mJournalSummaryUser = getDefaultList() ;
mLocationDefaults = getLocationDefaultList();
}
void KOPrefs::setCategoryDefaults()
{
mCustomCategories.clear();
mCustomCategories = getDefaultList();
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 5cc9bfa..53d193b 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -310,16 +310,17 @@ class KOPrefs : public KPimPrefs
bool mHightlightDateTimeEdit;
bool mShortDateInViewer;
bool mShowDateNavigator;
QStringList mLocationDefaults;
QStringList mEventSummaryUser;
QStringList mTodoSummaryUser;
+ QStringList mJournalSummaryUser;
bool mUseInternalAlarmNotification;
int mAlarmPlayBeeps;
int mAlarmSuspendTime;
int mAlarmSuspendCount;
int mAlarmBeepInterval;
int mOldLanguage;
int mOldLoadedLanguage;