summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/journalentry.cpp5
-rw-r--r--korganizer/koeventviewer.cpp10
2 files changed, 13 insertions, 2 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 05bfd31..232ea58 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -147,98 +147,103 @@ void JournalEntry::slotLoadTemplate()
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 );
setDirty();
}
void JournalEntry::setDate(const QDate &date)
{
showOnlyMode = false;
mDate = date;
writeJournal();
int id = mCalendar->defaultCalendar();
QString calname = KOPrefs::instance()->getCalendar( id )->mName;
mTitleLabel->setText( " (" + calname +")");
}
void JournalEntry::toggleShowJournal()
{
flushEntry();
if ( showOnlyMode )
emit showJournalOnly( 0 );
else
emit showJournalOnly( mJournal );
}
void JournalEntry::setShowOnly()
{
showOnlyMode = true;
mEditor->setFocus();
}
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 +")");
mDirty = false;
}
Journal *JournalEntry::journal() const
{
return mJournal;
}
void JournalEntry::setDirty()
{
mDirty = true;
// kdDebug() << "JournalEntry::setDirty()" << endl;
}
void JournalEntry::clear()
{
mJournal = 0;
mEditor->setText("");
}
bool JournalEntry::eventFilter( QObject *o, QEvent *e )
{
// kdDebug() << "JournalEntry::event received " << e->type() << endl;
if ( e->type() == QEvent::FocusOut ) {
writeJournal();
}
if ( e->type() == QEvent::KeyPress ) {
QKeyEvent * k = (QKeyEvent *) e;
if ( k->state() == Qt::ControlButton ) {
k->ignore();
//return true;
}
}
return QFrame::eventFilter( o, e ); // standard event processing
}
void JournalEntry::writeJournal()
{
// kdDebug() << "JournalEntry::writeJournal()" << endl;
if (!mDirty) return;
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index dcbb99f..8c1e5b2 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -655,108 +655,114 @@ void KOEventViewer::formatAttendees(Incidence *event)
++a_count;
mText += "<IMG src=\"" + NOiconPath + "\">";
}
mText += "</a>\n";
}
}
if (a->status() != Attendee::NeedsAction )
mText +="[" + a->statusStr() + "] ";
if (a->role() == Attendee::Chair )
mText +="(" + a->roleStr().left(1) + ".)";
}
mText.append("</li></ul>");
if ( (a_count+a_count_nr) > 1 ) {
mText += "<a href=\"mailto:ALL\">";
mText += i18n( "Mail to all" );
mText += "</a> ( ";
mText += "<IMG src=\"" + iconPath + "\">";
mText += i18n( " and " );
mText += "<IMG src=\"" + NOiconPath + "\"> )";
mText += "<br>\n";
}
if ( a_count_nr > 1 ) {
mText += "<a href=\"mailto:RSVP\">";
mText += i18n( "Mail to selected" );
mText += "</a> ( ";
mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath );
mText += "<br>\n";
}
}
}
void KOEventViewer::appendJournal(Journal *jour, int mode )
{
bool shortDate = KOPrefs::instance()->mShortDateInViewer;
if (mode == 0 ) {
addTag("h2",i18n("Journal from: "));
}
else {
if ( mode == 1 ) {
addTag("h2",i18n( "Local: " ) +i18n("Journal from: "));
} else {
addTag("h2",i18n( "Remote: " ) +i18n("Journal from: "));
}
}
topLevelWidget()->setCaption("Journal Viewer");
mText.append(i18n("<h3> %1 </h3> ").arg(jour->dtStartDateStr(KOPrefs::instance()->mShortDateInViewer)));
- addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
if (!jour->summary().isEmpty()) {
- addTag("p",i18n(" Title: ") + deTag(jour->summary()));
+ addTag("b",i18n(" Title: ") + deTag(jour->summary()));
}
+ formatReadOnly(jour);
+ addTag("b",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(jour->lastModified(),shortDate ) );
+
if (!jour->description().isEmpty()) {
addTag("p",deTag(jour->description()));
}
setText(mText);
}
void KOEventViewer::formatReadOnly(Incidence *event)
{
+ int id = event->calID();
+ if ( id > 1 ) {
+ addTag("p", i18n("Calendar:")+" " + KOPrefs::instance()->getCalendar( id )->mName );
+ }
if (event->isReadOnly()) {
addTag("p","<em>(" + i18n("read-only") + ")</em>");
}
}
void KOEventViewer::setSyncMode( bool b )
{
mSyncMode = b;
}
void KOEventViewer::setTodo(Todo *event, bool clearV )
{
if ( clearV )
clearEvents();
if ( mSyncMode ) {
if ( clearV )
appendTodo(event,1 );
else
appendTodo(event,2);
} else
appendTodo(event);
}
void KOEventViewer::setJournal(Journal *event, bool clearV )
{
if ( clearV )
clearEvents();
if ( mSyncMode ) {
if ( clearV )
appendJournal(event, 1);
else
appendJournal(event, 2);
} else
appendJournal(event);
}
void KOEventViewer::setEvent(Event *event)
{
clearEvents();
if ( mSyncMode )
appendEvent(event, 1);
else
appendEvent(event);
}
void KOEventViewer::addEvent(Event *event)
{
if ( mSyncMode )
appendEvent(event, 2);
else