summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-07-04 15:52:09 (UTC)
committer zautrix <zautrix>2005-07-04 15:52:09 (UTC)
commit226171366bc79927988eac10e0bf7fc3f7faea69 (patch) (side-by-side diff)
treefc2aef43c88d35bb4b59002bdfa25f7c45094f91
parent7221ff029af217ae703e8217333bd9b170203181 (diff)
downloadkdepimpi-226171366bc79927988eac10e0bf7fc3f7faea69.zip
kdepimpi-226171366bc79927988eac10e0bf7fc3f7faea69.tar.gz
kdepimpi-226171366bc79927988eac10e0bf7fc3f7faea69.tar.bz2
fixx
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp53
-rw-r--r--korganizer/journalentry.h7
-rw-r--r--korganizer/koeditorgeneral.cpp8
-rw-r--r--korganizer/kojournalview.cpp10
-rw-r--r--korganizer/koprefs.cpp10
-rw-r--r--korganizer/koprefs.h1
6 files changed, 63 insertions, 26 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 4751d40..56221dc 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -80,7 +80,7 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
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);
+ mCalendarBox = new QComboBox(vb);
+ //mTitleLabel->setMargin(0);
+ //mTitleLabel->setAlignment(AlignCenter);
QPushButton * loadTemplate = new QPushButton( vb );
QPushButton * saveTemplate = new QPushButton( vb );
@@ -100,4 +100,5 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
toggleJournal->setFixedSize( size , size );
mTitle->setMaximumHeight( size+4);
+ mCalendarBox->setMaximumHeight( size+4);
mEditor = new KTextEdit(this);
#ifndef DESKTOP_VERSION
@@ -177,7 +178,32 @@ void JournalEntry::setDate(const QDate &date)
writeJournal();
mDate = date;
- int id = mCalendar->defaultCalendar();
- QString calname = KOPrefs::instance()->getCalendar( id )->mName;
- mTitleLabel->setText( " (" + calname +")");
+ fillCalendar( mCalendar->defaultCalendar() );
+}
+void JournalEntry::fillCalendar( int setToID )
+{
+ mCalendarBox->clear();
+ KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
+ int std = 0;
+ int count = 0;
+ while ( kkf ) {
+ if ( (!kkf->mErrorOnLoad &&! kkf->isReadOnly) || setToID == kkf->mCalNumber ) {
+ if ( setToID ) {
+ if ( kkf->mCalNumber == setToID )
+ std = count;
+ } else {
+ if ( kkf->isStandard ) {
+ std = count;
+ }
+ }
+ ++count;
+ mCalendarBox->insertItem( kkf->mName );
+ }
+ kkf = KOPrefs::instance()->mCalendars.next();
+ }
+ mCalendarBox->setCurrentItem( std );
+ if ( KOPrefs::instance()->mCalendars.count() == 1 )
+ mCalendarBox->hide();
+ else
+ mCalendarBox->show();
}
@@ -207,7 +233,8 @@ void JournalEntry::setShowOnly()
mEditor->setFocus();
}
-void JournalEntry::setJournal(Journal *journal)
+void JournalEntry::setJournal(Journal *journal, bool saveJournal )
{
- writeJournal();
+ if ( saveJournal )
+ writeJournal();
mTitle->load( KOLocationBox::SUMMARYJOURNAL );
@@ -220,8 +247,5 @@ void JournalEntry::setJournal(Journal *journal)
mTitle->setEnabled (!journal->isReadOnly() );
mEditor->setReadOnly ( journal->isReadOnly() );
- int id = mJournal->calID();
-
- QString calname = KOPrefs::instance()->getCalendar( id )->mName;
- mTitleLabel->setText( " (" + calname +")");
+ fillCalendar( mJournal->calID() );
}
@@ -261,4 +285,5 @@ void JournalEntry::writeJournal()
{
if ( !visibleMode ) return;
+ if ( !mTitle->isEnabled() ) return;
if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) {
if ( mJournal ) {
@@ -287,4 +312,8 @@ void JournalEntry::writeJournal()
mTitle->save(KOLocationBox::SUMMARYJOURNAL);
}
+ int id = KOPrefs::instance()->getCalendarID( mCalendarBox->currentText() );
+ if ( mJournal->calID() != id ) {
+ mJournal->setCalID( id );
+ }
}
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index fb19fb1..ed04b7c 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -32,4 +32,5 @@
class QLabel;
class KTextEdit;
+class QComboBox;
class KLineEdit;
class KOLocationBox;
@@ -43,5 +44,5 @@ class JournalEntry : public QFrame {
virtual ~JournalEntry();
- void setJournal(Journal *);
+ void setJournal(Journal *, bool saveJournal = true );
Journal *journal() const;
@@ -54,5 +55,5 @@ class JournalEntry : public QFrame {
QSize sizeHint() const;
void setVisibleMode( bool b ) { visibleMode = b;}
-
+ void fillCalendar( int id = 0 );
protected slots:
void slotSaveTemplate();
@@ -77,5 +78,5 @@ class JournalEntry : public QFrame {
QDate mDate;
void keyPressEvent ( QKeyEvent * ) ;
- QLabel *mTitleLabel;
+ QComboBox *mCalendarBox;
KOLocationBox * mTitle;
KTextEdit *mEditor;
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index fd50b05..aa55d82 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -484,11 +484,5 @@ void KOEditorGeneral::fillCalCombo( int setToID )
int KOEditorGeneral::getCalendarID()
{
- KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first();
- while ( kkf ) {
- if ( mCalendarBox->currentText() == kkf->mName)
- return kkf->mCalNumber;
- kkf = KOPrefs::instance()->mCalendars.next();
- }
- return 1;
+ return KOPrefs::instance()->getCalendarID( mCalendarBox->currentText() );
}
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index 9b0e748..0523954 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -156,5 +156,5 @@ void KOJournalView::newJournal()
void KOJournalView::showOnly ( Journal* j )
{
- qDebug("showOnly %x ", j);
+ //qDebug("showOnly %x ", j);
flushView();
if ( j == 0 ) {
@@ -170,5 +170,5 @@ void KOJournalView::showOnly ( Journal* j )
void KOJournalView::showList(QPtrList<Journal> jl)
{
- qDebug("KOJournalView::showList %d",jl.count() );
+ //qDebug("KOJournalView::showList %d",jl.count() );
JournalEntry* mEntry = jEntries.first();
JournalEntry* firstEntry = mEntry;
@@ -178,12 +178,14 @@ void KOJournalView::showList(QPtrList<Journal> jl)
if ( !mEntry ) {
mEntry = getNewEntry();
+ mEntry->setVisibleMode( true );
mEntry->setDate(mDate);
- mEntry->setJournal(jl.at(iii));
+ mEntry->setJournal(jl.at(iii), false);
mEntry->setVisibleMode( true );
mEntry->show();
mEntry = 0;
} else {
+ mEntry->setVisibleMode( true );
mEntry->setDate(mDate);
- mEntry->setJournal(jl.at(iii));
+ mEntry->setJournal(jl.at(iii), false);
mEntry->setVisibleMode( true );
mEntry->show();
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp
index bb3d720..a886735 100644
--- a/korganizer/koprefs.cpp
+++ b/korganizer/koprefs.cpp
@@ -502,4 +502,14 @@ void KOPrefs::deleteCalendar( int num )
}
}
+int KOPrefs::getCalendarID( const QString & name )
+{
+ KopiCalendarFile * kkf = mCalendars.first();
+ while ( kkf ) {
+ if ( name == kkf->mName)
+ return kkf->mCalNumber;
+ kkf = mCalendars.next();
+ }
+ return 1;
+}
QString KOPrefs::calName( int calNum) const
{
diff --git a/korganizer/koprefs.h b/korganizer/koprefs.h
index 53d193b..7ec5327 100644
--- a/korganizer/koprefs.h
+++ b/korganizer/koprefs.h
@@ -101,4 +101,5 @@ class KOPrefs : public KPimPrefs
QColor defaultColor( int ) const;
QString calName( int ) const;
+ int getCalendarID( const QString & name );
protected:
void setTimeZoneIdDefault();