summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt5
-rw-r--r--bin/kdepim/korganizer/germantranslation.txt6
-rw-r--r--korganizer/journalentry.cpp83
-rw-r--r--korganizer/journalentry.h2
-rw-r--r--korganizer/koeventeditor.cpp4
-rw-r--r--microkde/kfiledialog.cpp4
-rw-r--r--microkde/ktextedit.h1
7 files changed, 99 insertions, 6 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 4421e61..41c60ea 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -23,8 +23,13 @@ If a todo is displayed closed in the todo view,
23it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties. 23it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties.
24 24
25Added info about the numbers of years to the caption (title) information about a birthday event. 25Added info about the numbers of years to the caption (title) information about a birthday event.
26 26
27Made completion date in todo editor editable.
28
29Added possibility to save/load templates for journals.
30(Which is just a simple "save text to file" or "insert text from file".
31
27********** VERSION 2.0.2 ************ 32********** VERSION 2.0.2 ************
28 33
29KO/Pi: 34KO/Pi:
30Fixed the layout problem of the day label buttons 35Fixed the layout problem of the day label buttons
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt
index b8080b5..5c18aaa 100644
--- a/bin/kdepim/korganizer/germantranslation.txt
+++ b/bin/kdepim/korganizer/germantranslation.txt
@@ -1217,8 +1217,14 @@
1217{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" }, 1217{ "Week view mode uses bigger font","Wochenansicht Modus nutzt größeren Font" },
1218{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" }, 1218{ "Set reminder ON with offset to:","Alarm AN mit Offset auf:" },
1219{ " on"," am" }, 1219{ " on"," am" },
1220{ " completed on "," erledigt am " }, 1220{ " completed on "," erledigt am " },
1221{ "Save as Event template","Speichere als Vorlage" },
1222{ "Load Event template","Lade Termin Vorlage" },
1223{ "Save as Journal template","Speichere als Journal Vorlage" },
1224{ "Insert Journal template","Füge Journal Vorlage ein" },
1225{ "","" },
1226{ "","" },
1221{ "","" }, 1227{ "","" },
1222{ "","" }, 1228{ "","" },
1223{ "","" }, 1229{ "","" },
1224{ "","" }, 1230{ "","" },
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 7af5cf4..dca42e0 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -25,13 +25,22 @@
25// Journal Entry 25// Journal Entry
26 26
27#include <qlabel.h> 27#include <qlabel.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qvbox.h>
30#include <qfile.h>
31#include <qdir.h>
32#include <qtextstream.h>
33#include <qtextcodec.h>
34#include <qpixmap.h>
35#include <qpushbutton.h>
29 36
30#include <kdebug.h> 37#include <kdebug.h>
31#include <kglobal.h> 38#include <kglobal.h>
32#include <klocale.h> 39#include <klocale.h>
33#include <ktextedit.h> 40#include <ktextedit.h>
41#include <kfiledialog.h>
42#include <kmessagebox.h>
34#include "koprefs.h" 43#include "koprefs.h"
35 44
36#include <libkcal/journal.h> 45#include <libkcal/journal.h>
37#include <libkcal/calendarresources.h> 46#include <libkcal/calendarresources.h>
@@ -49,9 +58,27 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
49 mCalendar = calendar; 58 mCalendar = calendar;
50 mJournal = 0; 59 mJournal = 0;
51 mDirty = false; 60 mDirty = false;
52 61
53 mTitleLabel = new QLabel(i18n("Title"),this); 62 QHBox * vb = new QHBox ( this );
63 QPushButton * loadTemplate = new QPushButton( vb );
64 QPushButton * saveTemplate = new QPushButton( vb );
65 QIconSet icon;
66 if ( QApplication::desktop()->width() < 321 )
67 icon = SmallIcon("fileexport16");
68 else
69 icon = SmallIcon("fileexport");
70 saveTemplate->setIconSet (icon ) ;
71 int size = saveTemplate->sizeHint().height();
72 saveTemplate->setFixedSize( size, size );
73 if ( QApplication::desktop()->width() < 321 )
74 icon = SmallIcon("fileimport16");
75 else
76 icon = SmallIcon("fileimport");
77 loadTemplate->setIconSet (icon ) ;
78 loadTemplate->setFixedSize( size, size );
79
80 mTitleLabel = new QLabel(i18n("Title"),vb);
54 mTitleLabel->setMargin(2); 81 mTitleLabel->setMargin(2);
55 mTitleLabel->setAlignment(AlignCenter); 82 mTitleLabel->setAlignment(AlignCenter);
56 83
57 mEditor = new KTextEdit(this); 84 mEditor = new KTextEdit(this);
@@ -60,17 +87,68 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
60 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); 87 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
61#endif 88#endif
62 mEditor->setWordWrap( KTextEdit::WidgetWidth ); 89 mEditor->setWordWrap( KTextEdit::WidgetWidth );
63 QBoxLayout *topLayout = new QVBoxLayout(this); 90 QBoxLayout *topLayout = new QVBoxLayout(this);
64 topLayout->addWidget(mTitleLabel); 91 topLayout->addWidget(vb);
65 topLayout->addWidget(mEditor); 92 topLayout->addWidget(mEditor);
66 mEditor->installEventFilter(this); 93 mEditor->installEventFilter(this);
94 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
95 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
67} 96}
68 97
69JournalEntry::~JournalEntry() 98JournalEntry::~JournalEntry()
70{ 99{
71} 100}
72 101
102void JournalEntry::slotSaveTemplate()
103{
104 QString fileName =locateLocal( "templates", "journals" );
105 QDir t_dir;
106 if ( !t_dir.exists(fileName) )
107 t_dir.mkdir ( fileName );
108 fileName += "/journal";
109 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this );
110 if ( fileName.length() == 0 )
111 return;
112
113 QFile fileIn( fileName );
114 if (!fileIn.open( IO_WriteOnly ) ) {
115 KMessageBox::error( this, i18n("Error saving template file\n '%1'.")
116 .arg( fileName ) );
117 return;
118 }
119 // QString text;
120 QTextStream tsIn( &fileIn );
121 tsIn.setCodec( QTextCodec::codecForName("utf8") );
122 tsIn << mEditor->text();
123 fileIn.close();
124}
125void JournalEntry::slotLoadTemplate()
126{
127 QString fileName =locateLocal( "templates", "journals" );
128 QDir t_dir;
129 if ( !t_dir.exists(fileName) )
130 t_dir.mkdir ( fileName );
131 fileName += "/journal";
132 fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this );
133 if ( fileName.length() == 0 )
134 return;
135 QFile fileIn( fileName );
136 if (!fileIn.open( IO_ReadOnly ) ) {
137 KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
138 .arg( fileName ) );
139 return;
140 }
141 QTextStream tsIn( &fileIn );
142 tsIn.setCodec( QTextCodec::codecForName("utf8") );
143 QString text = tsIn.read();
144 fileIn.close();
145 int line, col;
146 mEditor->getCursorPosition (& line, & col );
147 mEditor-> insertAt ( text, line, col, true );
148 //mEditor->setIgnoreMark( true );
149 setDirty();
150}
73void JournalEntry::setDate(const QDate &date) 151void JournalEntry::setDate(const QDate &date)
74{ 152{
75 writeJournal(); 153 writeJournal();
76 154
@@ -152,8 +230,9 @@ void JournalEntry::writeJournal()
152 mCalendar->addJournal(mJournal); 230 mCalendar->addJournal(mJournal);
153 } 231 }
154 232
155 mJournal->setDescription(mEditor->text()); 233 mJournal->setDescription(mEditor->text());
234 //qDebug("tttt%s ", mEditor->text().latin1());
156 235
157 mDirty = false; 236 mDirty = false;
158} 237}
159 238
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index 1f784f4..f1a1fef 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -49,8 +49,10 @@ class JournalEntry : public QFrame {
49 49
50 void flushEntry(); 50 void flushEntry();
51 51
52 protected slots: 52 protected slots:
53 void slotSaveTemplate();
54 void slotLoadTemplate();
53 void setDirty(); 55 void setDirty();
54 signals: 56 signals:
55 void deleteJournal(Journal *); 57 void deleteJournal(Journal *);
56 58
diff --git a/korganizer/koeventeditor.cpp b/korganizer/koeventeditor.cpp
index 0ff99a4..337db9b 100644
--- a/korganizer/koeventeditor.cpp
+++ b/korganizer/koeventeditor.cpp
@@ -334,9 +334,9 @@ void KOEventEditor::slotLoadTemplate()
334 QDir t_dir; 334 QDir t_dir;
335 if ( !t_dir.exists(fileName) ) 335 if ( !t_dir.exists(fileName) )
336 t_dir.mkdir ( fileName ); 336 t_dir.mkdir ( fileName );
337 fileName += "/event"; 337 fileName += "/event";
338 fileName = KFileDialog::getSaveFileName( fileName , "Load Event template", this ); 338 fileName = KFileDialog::getOpenFileName( fileName , i18n("Load Event template"), this );
339 if ( fileName.length() == 0 ) 339 if ( fileName.length() == 0 )
340 return; 340 return;
341 CalendarLocal cal; 341 CalendarLocal cal;
342 ICalFormat format; 342 ICalFormat format;
@@ -363,9 +363,9 @@ void KOEventEditor::slotSaveTemplate()
363 QDir t_dir; 363 QDir t_dir;
364 if ( !t_dir.exists(fileName) ) 364 if ( !t_dir.exists(fileName) )
365 t_dir.mkdir ( fileName ); 365 t_dir.mkdir ( fileName );
366 fileName += "/event"; 366 fileName += "/event";
367 fileName = KFileDialog::getSaveFileName( fileName , "Save as Event template", this ); 367 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Event template"), this );
368 if ( fileName.length() > 0 ) 368 if ( fileName.length() > 0 )
369 saveTemplate( fileName ); 369 saveTemplate( fileName );
370} 370}
371 371
diff --git a/microkde/kfiledialog.cpp b/microkde/kfiledialog.cpp
index 309f8dc..3f47425 100644
--- a/microkde/kfiledialog.cpp
+++ b/microkde/kfiledialog.cpp
@@ -15,9 +15,8 @@ QString KFileDialog::getSaveFileName( const QString & fn,
15 QDialog dia ( par, "input-dialog", true ); 15 QDialog dia ( par, "input-dialog", true );
16 QVBoxLayout lay( &dia ); 16 QVBoxLayout lay( &dia );
17 lay.setMargin(7); 17 lay.setMargin(7);
18 lay.setSpacing(7); 18 lay.setSpacing(7);
19 dia.setCaption( cap );
20 QString file = fn; 19 QString file = fn;
21 if ( file.isEmpty() ) 20 if ( file.isEmpty() )
22 file = QDir::homeDirPath()+"/*"; 21 file = QDir::homeDirPath()+"/*";
23 QFileInfo fi ( file ); 22 QFileInfo fi ( file );
@@ -26,8 +25,9 @@ QString KFileDialog::getSaveFileName( const QString & fn,
26 lay.addWidget( &o); 25 lay.addWidget( &o);
27 // o.setNewVisible( true ); 26 // o.setNewVisible( true );
28 // o.setNameVisible( true ); 27 // o.setNameVisible( true );
29 dia.showMaximized(); 28 dia.showMaximized();
29 dia.setCaption( cap );
30 int res = dia.exec(); 30 int res = dia.exec();
31 if ( res ) 31 if ( res )
32 retfile = o.selectedName(); 32 retfile = o.selectedName();
33 return retfile; 33 return retfile;
@@ -41,17 +41,17 @@ QString KFileDialog::getOpenFileName( const QString & fn,
41 // QLineEdit lab ( &dia ); 41 // QLineEdit lab ( &dia );
42 QVBoxLayout lay( &dia ); 42 QVBoxLayout lay( &dia );
43 lay.setMargin(7); 43 lay.setMargin(7);
44 lay.setSpacing(7); 44 lay.setSpacing(7);
45 dia.setCaption( cap );
46 QString file = fn; 45 QString file = fn;
47 if ( file.isEmpty() ) 46 if ( file.isEmpty() )
48 file = QDir::homeDirPath()+"/*";; 47 file = QDir::homeDirPath()+"/*";;
49 QFileInfo fi ( file ); 48 QFileInfo fi ( file );
50 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() ); 49 OFileSelector o ( &dia,OFileSelector::FileSelector, OFileSelector::Open, fi.dirPath(true), fi.fileName() );
51 QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) ); 50 QObject::connect ( &o, SIGNAL( ok() ), &dia, SLOT ( accept () ) );
52 lay.addWidget( &o); 51 lay.addWidget( &o);
53 dia.showMaximized(); 52 dia.showMaximized();
53 dia.setCaption( cap );
54 int res = dia.exec(); 54 int res = dia.exec();
55 if ( res ) 55 if ( res )
56 retfile = o.selectedName(); 56 retfile = o.selectedName();
57 return retfile; 57 return retfile;
diff --git a/microkde/ktextedit.h b/microkde/ktextedit.h
index c912f3b..87c0602 100644
--- a/microkde/ktextedit.h
+++ b/microkde/ktextedit.h
@@ -6,8 +6,9 @@
6class KTextEdit : public QMultiLineEdit 6class KTextEdit : public QMultiLineEdit
7{ 7{
8 public: 8 public:
9 KTextEdit( QWidget *parent ) ; 9 KTextEdit( QWidget *parent ) ;
10 void setIgnoreMark( bool b ) { mIgnoreMark = b; }
10 11
11 private: 12 private:
12 bool mAllowPopupMenu; 13 bool mAllowPopupMenu;
13 bool mMouseDown; 14 bool mMouseDown;