author | zautrix <zautrix> | 2005-06-30 05:32:10 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-30 05:32:10 (UTC) |
commit | da264cf19c0183d6ea4e8dab6eabd40994e351c8 (patch) (side-by-side diff) | |
tree | 061026fe6869c365641853b1ebba542b852046bc /korganizer/journalentry.cpp | |
parent | 4e850fa7aa99f92676e49466cfccaa5d5e0ec24c (diff) | |
download | kdepimpi-da264cf19c0183d6ea4e8dab6eabd40994e351c8.zip kdepimpi-da264cf19c0183d6ea4e8dab6eabd40994e351c8.tar.gz kdepimpi-da264cf19c0183d6ea4e8dab6eabd40994e351c8.tar.bz2 |
fixxx
-rw-r--r-- | korganizer/journalentry.cpp | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 58863fe..add874f 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp @@ -60,39 +60,37 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : heiHint = QApplication::desktop()->height() / 5 ; 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); mTitleLabel->setMargin(0); mTitleLabel->setAlignment(AlignCenter); 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 mEditor->setWordWrap( KTextEdit::WidgetWidth ); @@ -100,9 +98,8 @@ 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( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); } @@ -160,9 +157,8 @@ void JournalEntry::slotLoadTemplate() int line, col; mEditor->getCursorPosition (& line, & col ); mEditor-> insertAt ( text, line, col, true ); //mEditor->setIgnoreMark( true ); - setDirty(); } void JournalEntry::setDate(const QDate &date) { showOnlyMode = false; @@ -202,22 +198,15 @@ void JournalEntry::setJournal(Journal *journal) QString calname = KOPrefs::instance()->getCalendar( id )->mName; mTitleLabel->setText( " (" + calname +")"); - mDirty = false; } Journal *JournalEntry::journal() const { return mJournal; } -void JournalEntry::setDirty() -{ - mDirty = true; - -// kdDebug() << "JournalEntry::setDirty()" << endl; -} void JournalEntry::clear() { mJournal = 0; @@ -243,14 +232,11 @@ 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); KOPrefs::instance()->mConfirm = conf; @@ -268,16 +254,13 @@ void JournalEntry::writeJournal() } mJournal->setDescription(mEditor->text()); mJournal->setSummary(mTitle->text()); - mDirty = false; } void JournalEntry::flushEntry() { - if (!mDirty) return; - - writeJournal(); + writeJournal(); } void JournalEntry::keyPressEvent ( QKeyEvent * e ) { e->ignore(); |