summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/journalentry.cpp37
-rw-r--r--korganizer/journalentry.h3
-rw-r--r--korganizer/kojournalview.cpp6
3 files changed, 14 insertions, 32 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 58863fe..add874f 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -61,14 +61,13 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
showOnlyMode = false;
mCalendar = calendar;
mJournal = 0;
- mDirty = false;
QHBox * vb = new QHBox ( this );
- QIconSet icon;
+ QPixmap iconp;
QPushButton * toggleJournal = new QPushButton( vb );
- icon = SmallIcon("1updownarrow");
- toggleJournal->setIconSet (icon ) ;
+ iconp = SmallIcon("1updownarrow");
+ toggleJournal->setPixmap (iconp ) ;
new QLabel(i18n(" Title: "),vb);
mTitle = new KLineEdit ( vb );
mTitleLabel = new QLabel(i18n("Title"),vb);
@@ -77,21 +76,20 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
QPushButton * loadTemplate = new QPushButton( vb );
QPushButton * saveTemplate = new QPushButton( vb );
if ( QApplication::desktop()->width() < 321 )
- icon = SmallIcon("fileexport16");
+ iconp = SmallIcon("fileexport16");
else
- icon = SmallIcon("fileexport");
- saveTemplate->setIconSet (icon ) ;
+ iconp = SmallIcon("fileexport");
+ saveTemplate->setPixmap (iconp ) ;
int size = saveTemplate->sizeHint().height();
if ( QApplication::desktop()->width() < 321 )
- icon = SmallIcon("fileimport16");
+ iconp = SmallIcon("fileimport16");
else
- icon = SmallIcon("fileimport");
- loadTemplate->setIconSet (icon ) ;
+ iconp = SmallIcon("fileimport");
+ loadTemplate->setPixmap (iconp ) ;
loadTemplate->setFixedSize( size, size );
saveTemplate->setFixedSize( size, size );
toggleJournal->setFixedSize( size , size );
mEditor = new KTextEdit(this);
- connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty()));
#ifndef DESKTOP_VERSION
QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
#endif
@@ -101,7 +99,6 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
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( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) );
}
@@ -161,7 +158,6 @@ void JournalEntry::slotLoadTemplate()
mEditor->getCursorPosition (& line, & col );
mEditor-> insertAt ( text, line, col, true );
//mEditor->setIgnoreMark( true );
- setDirty();
}
void JournalEntry::setDate(const QDate &date)
{
@@ -203,7 +199,6 @@ void JournalEntry::setJournal(Journal *journal)
QString calname = KOPrefs::instance()->getCalendar( id )->mName;
mTitleLabel->setText( " (" + calname +")");
- mDirty = false;
}
Journal *JournalEntry::journal() const
@@ -211,12 +206,6 @@ Journal *JournalEntry::journal() const
return mJournal;
}
-void JournalEntry::setDirty()
-{
- mDirty = true;
-
-// kdDebug() << "JournalEntry::setDirty()" << endl;
-}
void JournalEntry::clear()
{
@@ -244,12 +233,9 @@ bool JournalEntry::eventFilter( QObject *o, QEvent *e )
void JournalEntry::writeJournal()
{
-// kdDebug() << "JournalEntry::writeJournal()" << endl;
- if (!mDirty) return;
- if (mEditor->text().isEmpty()) {
+ if (mEditor->text().isEmpty() && mTitle->text().isEmpty()) {
if ( mJournal ) {
- mDirty = false;
bool conf = KOPrefs::instance()->mConfirm;
KOPrefs::instance()->mConfirm = false;
emit deleteJournal(mJournal);
@@ -269,13 +255,10 @@ void JournalEntry::writeJournal()
mJournal->setDescription(mEditor->text());
mJournal->setSummary(mTitle->text());
- mDirty = false;
}
void JournalEntry::flushEntry()
{
- if (!mDirty) return;
-
writeJournal();
}
void JournalEntry::keyPressEvent ( QKeyEvent * e )
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index b37cabd..f2db785 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -55,7 +55,6 @@ class JournalEntry : public QFrame {
protected slots:
void slotSaveTemplate();
void slotLoadTemplate();
- void setDirty();
void toggleShowJournal();
signals:
void deleteJournal(Journal *);
@@ -77,8 +76,6 @@ class JournalEntry : public QFrame {
KLineEdit * mTitle;
KTextEdit *mEditor;
int heiHint;
-
- bool mDirty;
};
#endif
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index ff87ef4..cb9a2c0 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -59,12 +59,12 @@ KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
mTopLayout = new QVBoxLayout(parWid);
QHBox * vb = new QHBox ( parWid );
QPushButton * newJournal = new QPushButton( vb );
- QIconSet icon;
+ QPixmap icon;
if ( QApplication::desktop()->width() < 321 )
icon = SmallIcon("ko16old");
else
icon = SmallIcon("ko24old");
- newJournal->setIconSet (icon ) ;
+ newJournal->setPixmap (icon ) ;
int size = newJournal->sizeHint().height();
newJournal->setFixedSize( size, size );
mDateLabel = new QLabel ( vb );
@@ -138,6 +138,7 @@ void KOJournalView::clearList()
}
void KOJournalView::newJournal()
{
+ flushView();
Journal* mJournal = new Journal;
mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
mCalendar->addJournal(mJournal);
@@ -146,6 +147,7 @@ void KOJournalView::newJournal()
void KOJournalView::showOnly ( Journal* j )
{
+ flushView();
if ( j == 0 ) {
showDates( mDate, QDate() );
return;