summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-06-30 12:37:10 (UTC)
committer zautrix <zautrix>2005-06-30 12:37:10 (UTC)
commit4c19ba3345d1af263c02ebe564e56d9dec679347 (patch) (side-by-side diff)
tree1ac48610c5545998670fa1c14592ef4e1981ce94
parent13eb32c82e736b033435e596111b7b0f3fe75608 (diff)
downloadkdepimpi-4c19ba3345d1af263c02ebe564e56d9dec679347.zip
kdepimpi-4c19ba3345d1af263c02ebe564e56d9dec679347.tar.gz
kdepimpi-4c19ba3345d1af263c02ebe564e56d9dec679347.tar.bz2
fixx
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/journalentry.cpp11
-rw-r--r--korganizer/journalentry.h1
-rw-r--r--korganizer/kojournalview.cpp10
3 files changed, 15 insertions, 7 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 9e2c902..ca8d5f7 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -141,72 +141,79 @@ void JournalEntry::slotLoadTemplate()
if ( !t_dir.exists(fileName) )
t_dir.mkdir ( fileName );
fileName += "/journal";
fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this );
if ( fileName.length() == 0 )
return;
QFile fileIn( fileName );
if (!fileIn.open( IO_ReadOnly ) ) {
KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
.arg( fileName ) );
return;
}
QTextStream tsIn( &fileIn );
tsIn.setCodec( QTextCodec::codecForName("utf8") );
QString text = tsIn.read();
fileIn.close();
int line, col;
mEditor->getCursorPosition (& line, & col );
mEditor-> insertAt ( text, line, col, true );
//mEditor->setIgnoreMark( true );
}
void JournalEntry::setDate(const QDate &date)
{
showOnlyMode = false;
- mDate = date;
writeJournal();
+ 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())
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() ) );
}
}
+void JournalEntry::setVisibleOn()
+{
+ visibleMode = true;
+}
void JournalEntry::setShowOnly()
{
showOnlyMode = true;
+ if ( mTitle->text().isEmpty() )
+ mTitle->setFocus();
+ else
mEditor->setFocus();
- visibleMode = true;
}
void JournalEntry::setJournal(Journal *journal)
{
writeJournal();
mJournal = journal;
if ( journal->isReadOnly() )
mTitle->setText(mJournal->summary()+" ("+i18n("readonly")+")");
else
mTitle->setText(mJournal->summary());
mEditor->setText(mJournal->description());
mTitle->setReadOnly (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;
}
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index e98d018..cc9b5ef 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -36,48 +36,49 @@ class KLineEdit;
using namespace KCal;
class JournalEntry : public QFrame {
Q_OBJECT
public:
JournalEntry(Calendar *,QWidget *parent);
virtual ~JournalEntry();
void setJournal(Journal *);
Journal *journal() const;
void setDate(const QDate &);
void clear();
void flushEntry();
void setShowOnly();
QSize sizeHint() const;
void setVisibleMode( bool b ) { visibleMode = b;}
protected slots:
void slotSaveTemplate();
void slotLoadTemplate();
void toggleShowJournal();
+ void setVisibleOn();
signals:
void deleteJournal(Journal *);
void newJournal();
void showJournalOnly( Journal * );
protected:
bool eventFilter( QObject *o, QEvent *e );
void writeJournal();
private:
bool visibleMode;
bool showOnlyMode;
Calendar *mCalendar;
Journal *mJournal;
QDate mDate;
void keyPressEvent ( QKeyEvent * ) ;
QLabel *mTitleLabel;
KLineEdit * mTitle;
KTextEdit *mEditor;
int heiHint;
};
#endif
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index 7a96aa5..6fa9b23 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -134,80 +134,80 @@ void KOJournalView::flushView()
}
ff = false;
}
void KOJournalView::clearList()
{
JournalEntry* mEntry = jEntries.first();
while ( mEntry ) {
mEntry->clear();
mEntry = jEntries.next();
}
}
void KOJournalView::newJournal()
{
//qDebug(" KOJournalView::newJournal()");
flushView();
Journal* mJournal = new Journal;
mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
mCalendar->addJournal(mJournal);
showDates( mDate, QDate() );
}
void KOJournalView::showOnly ( Journal* j )
{
- //qDebug("showOnly %x ", j);
+ qDebug("showOnly %x ", j);
flushView();
if ( j == 0 ) {
showDates( mDate, QDate() );
return;
}
QPtrList<Journal> jl;
jl.append ( j );
showList( jl );
JournalEntry* mEntry = jEntries.first();
mEntry->setShowOnly();
}
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;
int count = jl.count();
int iii = 0;
while ( iii < count ) {
if ( !mEntry ) {
mEntry = getNewEntry();
- mEntry->show();
- mEntry->setVisibleMode( true );
mEntry->setDate(mDate);
mEntry->setJournal(jl.at(iii));
+ mEntry->setVisibleMode( true );
+ mEntry->show();
mEntry = 0;
} else {
mEntry->setDate(mDate);
mEntry->setJournal(jl.at(iii));
- mEntry->show();
mEntry->setVisibleMode( true );
+ mEntry->show();
mEntry = jEntries.next();
}
++iii;
}
while ( mEntry ) {
mEntry->setDate(mDate);
mEntry->clear();
if ( mEntry != firstEntry ) {
mEntry->hide();
mEntry->setVisibleMode( false );
}
else {
mEntry->setVisibleMode( true );
mEntry->show();
}
mEntry = jEntries.next();
}
}
void KOJournalView::showDates(const QDate &start, const QDate &)
{
mDate = start;
mDateLabel-> setText(KGlobal::locale()->formatDate(mDate));
QPtrList<Journal> jl = calendar()->journals4Date( start );