summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-06-29 11:08:57 (UTC)
committer zautrix <zautrix>2005-06-29 11:08:57 (UTC)
commit435e68d6ace30fb2121b718226e00be44971c617 (patch) (unidiff)
tree2b7d2793f0244db82a9cddbfab8957d13989ed20 /korganizer
parentb7044dfc9516d546683973985555c481d59fc677 (diff)
downloadkdepimpi-435e68d6ace30fb2121b718226e00be44971c617.zip
kdepimpi-435e68d6ace30fb2121b718226e00be44971c617.tar.gz
kdepimpi-435e68d6ace30fb2121b718226e00be44971c617.tar.bz2
fixx
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp7
-rw-r--r--korganizer/journalentry.h2
-rw-r--r--korganizer/kojournalview.cpp11
-rw-r--r--korganizer/kojournalview.h1
4 files changed, 18 insertions, 3 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 7274849..0b923ad 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -35,48 +35,49 @@
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qapplication.h> 36#include <qapplication.h>
37 37
38#include <kdebug.h> 38#include <kdebug.h>
39#include <kglobal.h> 39#include <kglobal.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <ktextedit.h> 41#include <ktextedit.h>
42#include <kfiledialog.h> 42#include <kfiledialog.h>
43#include <kmessagebox.h> 43#include <kmessagebox.h>
44#include "koprefs.h" 44#include "koprefs.h"
45 45
46#include <libkcal/journal.h> 46#include <libkcal/journal.h>
47#include <libkcal/calendarresources.h> 47#include <libkcal/calendarresources.h>
48#include <libkcal/resourcecalendar.h> 48#include <libkcal/resourcecalendar.h>
49#include <kresources/resourceselectdialog.h> 49#include <kresources/resourceselectdialog.h>
50 50
51#include "journalentry.h" 51#include "journalentry.h"
52//#include "journalentry.moc" 52//#include "journalentry.moc"
53#ifndef DESKTOP_VERSION 53#ifndef DESKTOP_VERSION
54#include <qpe/qpeapplication.h> 54#include <qpe/qpeapplication.h>
55#endif 55#endif
56JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : 56JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
57 QFrame(parent) 57 QFrame(parent)
58{ 58{
59 heiHint = QApplication::desktop()->height() / 5 ;
59 showOnlyMode = false; 60 showOnlyMode = false;
60 mCalendar = calendar; 61 mCalendar = calendar;
61 mJournal = 0; 62 mJournal = 0;
62 mDirty = false; 63 mDirty = false;
63 64
64 QHBox * vb = new QHBox ( this ); 65 QHBox * vb = new QHBox ( this );
65 QPushButton * newJournal = new QPushButton( vb ); 66 QPushButton * newJournal = new QPushButton( vb );
66 QIconSet icon; 67 QIconSet icon;
67 if ( QApplication::desktop()->width() < 321 ) 68 if ( QApplication::desktop()->width() < 321 )
68 icon = SmallIcon("ko16old"); 69 icon = SmallIcon("ko16old");
69 else 70 else
70 icon = SmallIcon("ko24old"); 71 icon = SmallIcon("ko24old");
71 newJournal->setIconSet (icon ) ; 72 newJournal->setIconSet (icon ) ;
72 int size = newJournal->sizeHint().height(); 73 int size = newJournal->sizeHint().height();
73 newJournal->setFixedSize( size, size ); 74 newJournal->setFixedSize( size, size );
74 75
75 76
76 QPushButton * toggleJournal = new QPushButton( vb ); 77 QPushButton * toggleJournal = new QPushButton( vb );
77 icon = SmallIcon("1updownarrow"); 78 icon = SmallIcon("1updownarrow");
78 toggleJournal->setIconSet (icon ) ; 79 toggleJournal->setIconSet (icon ) ;
79 //int size = toggleJournal->sizeHint().height(); 80 //int size = toggleJournal->sizeHint().height();
80 toggleJournal->setFixedSize( size * 2 /3 , size ); 81 toggleJournal->setFixedSize( size * 2 /3 , size );
81 82
82 83
@@ -96,50 +97,54 @@ JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) :
96 if ( QApplication::desktop()->width() < 321 ) 97 if ( QApplication::desktop()->width() < 321 )
97 icon = SmallIcon("fileimport16"); 98 icon = SmallIcon("fileimport16");
98 else 99 else
99 icon = SmallIcon("fileimport"); 100 icon = SmallIcon("fileimport");
100 loadTemplate->setIconSet (icon ) ; 101 loadTemplate->setIconSet (icon ) ;
101 loadTemplate->setFixedSize( size, size ); 102 loadTemplate->setFixedSize( size, size );
102 mEditor = new KTextEdit(this); 103 mEditor = new KTextEdit(this);
103 connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty())); 104 connect(mEditor,SIGNAL(textChanged()),SLOT(setDirty()));
104#ifndef DESKTOP_VERSION 105#ifndef DESKTOP_VERSION
105 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); 106 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
106#endif 107#endif
107 mEditor->setWordWrap( KTextEdit::WidgetWidth ); 108 mEditor->setWordWrap( KTextEdit::WidgetWidth );
108 QBoxLayout *topLayout = new QVBoxLayout(this); 109 QBoxLayout *topLayout = new QVBoxLayout(this);
109 topLayout->addWidget(vb); 110 topLayout->addWidget(vb);
110 topLayout->addWidget(mEditor); 111 topLayout->addWidget(mEditor);
111 mEditor->installEventFilter(this); 112 mEditor->installEventFilter(this);
112 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 113 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
113 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 114 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
114 connect( newJournal, SIGNAL( clicked() ), this , SIGNAL( newJournal() ) ); 115 connect( newJournal, SIGNAL( clicked() ), this , SIGNAL( newJournal() ) );
115 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); 116 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) );
116} 117}
117 118
118JournalEntry::~JournalEntry() 119JournalEntry::~JournalEntry()
119{ 120{
121 qDebug("JournalEntry::~JournalEntry() ");
122}
123QSize JournalEntry::sizeHint() const
124{
125 return QSize ( 240, heiHint );
120} 126}
121
122void JournalEntry::slotSaveTemplate() 127void JournalEntry::slotSaveTemplate()
123{ 128{
124 QString fileName =locateLocal( "templates", "journals" ); 129 QString fileName =locateLocal( "templates", "journals" );
125 QDir t_dir; 130 QDir t_dir;
126 if ( !t_dir.exists(fileName) ) 131 if ( !t_dir.exists(fileName) )
127 t_dir.mkdir ( fileName ); 132 t_dir.mkdir ( fileName );
128 fileName += "/journal"; 133 fileName += "/journal";
129 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); 134 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this );
130 if ( fileName.length() == 0 ) 135 if ( fileName.length() == 0 )
131 return; 136 return;
132 137
133 QFile fileIn( fileName ); 138 QFile fileIn( fileName );
134 if (!fileIn.open( IO_WriteOnly ) ) { 139 if (!fileIn.open( IO_WriteOnly ) ) {
135 KMessageBox::error( this, i18n("Error saving template file\n '%1'.") 140 KMessageBox::error( this, i18n("Error saving template file\n '%1'.")
136 .arg( fileName ) ); 141 .arg( fileName ) );
137 return; 142 return;
138 } 143 }
139 // QString text; 144 // QString text;
140 QTextStream tsIn( &fileIn ); 145 QTextStream tsIn( &fileIn );
141 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 146 tsIn.setCodec( QTextCodec::codecForName("utf8") );
142 tsIn << mEditor->text(); 147 tsIn << mEditor->text();
143 fileIn.close(); 148 fileIn.close();
144} 149}
145void JournalEntry::slotLoadTemplate() 150void JournalEntry::slotLoadTemplate()
diff --git a/korganizer/journalentry.h b/korganizer/journalentry.h
index 85ad5df..b0e9cc7 100644
--- a/korganizer/journalentry.h
+++ b/korganizer/journalentry.h
@@ -28,53 +28,55 @@
28#include <qframe.h> 28#include <qframe.h>
29 29
30#include <libkcal/calendar.h> 30#include <libkcal/calendar.h>
31 31
32class QLabel; 32class QLabel;
33class KTextEdit; 33class KTextEdit;
34 34
35using namespace KCal; 35using namespace KCal;
36 36
37class JournalEntry : public QFrame { 37class JournalEntry : public QFrame {
38 Q_OBJECT 38 Q_OBJECT
39 public: 39 public:
40 JournalEntry(Calendar *,QWidget *parent); 40 JournalEntry(Calendar *,QWidget *parent);
41 virtual ~JournalEntry(); 41 virtual ~JournalEntry();
42 42
43 void setJournal(Journal *); 43 void setJournal(Journal *);
44 Journal *journal() const; 44 Journal *journal() const;
45 45
46 void setDate(const QDate &); 46 void setDate(const QDate &);
47 47
48 void clear(); 48 void clear();
49 49
50 void flushEntry(); 50 void flushEntry();
51 void setShowOnly() {showOnlyMode = true;} 51 void setShowOnly() {showOnlyMode = true;}
52 QSize sizeHint() const;
52 53
53 protected slots: 54 protected slots:
54 void slotSaveTemplate(); 55 void slotSaveTemplate();
55 void slotLoadTemplate(); 56 void slotLoadTemplate();
56 void setDirty(); 57 void setDirty();
57 void toggleShowJournal(); 58 void toggleShowJournal();
58 signals: 59 signals:
59 void deleteJournal(Journal *); 60 void deleteJournal(Journal *);
60 void newJournal(); 61 void newJournal();
61 void showJournalOnly( Journal * ); 62 void showJournalOnly( Journal * );
62 63
63 protected: 64 protected:
64 bool eventFilter( QObject *o, QEvent *e ); 65 bool eventFilter( QObject *o, QEvent *e );
65 66
66 void writeJournal(); 67 void writeJournal();
67 68
68 private: 69 private:
69 bool showOnlyMode; 70 bool showOnlyMode;
70 Calendar *mCalendar; 71 Calendar *mCalendar;
71 Journal *mJournal; 72 Journal *mJournal;
72 QDate mDate; 73 QDate mDate;
73 void keyPressEvent ( QKeyEvent * ) ; 74 void keyPressEvent ( QKeyEvent * ) ;
74 QLabel *mTitleLabel; 75 QLabel *mTitleLabel;
75 KTextEdit *mEditor; 76 KTextEdit *mEditor;
77 int heiHint;
76 78
77 bool mDirty; 79 bool mDirty;
78}; 80};
79 81
80#endif 82#endif
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index fae59d6..9e354d3 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -4,81 +4,88 @@
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24// 24//
25// View of Journal entries 25// View of Journal entries
26 26
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qscrollview.h>
28#include <qpopupmenu.h> 29#include <qpopupmenu.h>
29 30
30#include <klocale.h> 31#include <klocale.h>
31#include <kdebug.h> 32#include <kdebug.h>
32#include "koprefs.h" 33#include "koprefs.h"
33 34
34#include <libkcal/calendar.h> 35#include <libkcal/calendar.h>
35 36
36#include "journalentry.h" 37#include "journalentry.h"
37 38
38#include "kojournalview.h" 39#include "kojournalview.h"
39using namespace KOrg; 40using namespace KOrg;
40 41
41KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, 42KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
42 const char *name) 43 const char *name)
43 : KOrg::BaseView(calendar, parent, name) 44 : KOrg::BaseView(calendar, parent, name)
44{ 45{
45 mCalendar = calendar; 46 mCalendar = calendar;
46 mTopLayout = new QVBoxLayout(this); 47 QScrollView * sv = new QScrollView( this );
48 QHBoxLayout * hbl = new QHBoxLayout( this );
49 hbl->addWidget( sv );
50 parWid = new QWidget( sv->viewport() );
51 sv->addChild(parWid);
52 sv->setResizePolicy( QScrollView:: AutoOneFit );
53 mTopLayout = new QVBoxLayout(parWid);
47 getNewEntry(); 54 getNewEntry();
48} 55}
49 56
50KOJournalView::~KOJournalView() 57KOJournalView::~KOJournalView()
51{ 58{
52} 59}
53 60
54int KOJournalView::currentDateCount() 61int KOJournalView::currentDateCount()
55{ 62{
56 return 0; 63 return 0;
57} 64}
58JournalEntry* KOJournalView::getNewEntry() 65JournalEntry* KOJournalView::getNewEntry()
59{ 66{
60 JournalEntry* Entry = new JournalEntry(mCalendar,this); 67 JournalEntry* Entry = new JournalEntry(mCalendar,parWid);
61 jEntries.append( Entry ); 68 jEntries.append( Entry );
62 mTopLayout->addWidget(Entry); 69 mTopLayout->addWidget(Entry);
63 Entry->setFont ( KOPrefs::instance()->mJornalViewFont ); 70 Entry->setFont ( KOPrefs::instance()->mJornalViewFont );
64 connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; 71 connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ;
65 connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ; 72 connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ;
66 connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ; 73 connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ;
67 return Entry; 74 return Entry;
68} 75}
69 76
70QPtrList<Incidence> KOJournalView::selectedIncidences() 77QPtrList<Incidence> KOJournalView::selectedIncidences()
71{ 78{
72 QPtrList<Incidence> eventList; 79 QPtrList<Incidence> eventList;
73 80
74 return eventList; 81 return eventList;
75} 82}
76void KOJournalView::updateConfig() 83void KOJournalView::updateConfig()
77{ 84{
78 JournalEntry* mEntry = jEntries.first(); 85 JournalEntry* mEntry = jEntries.first();
79 while ( mEntry ) { 86 while ( mEntry ) {
80 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 87 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
81 mEntry = jEntries.next(); 88 mEntry = jEntries.next();
82 } 89 }
83} 90}
84void KOJournalView::updateView() 91void KOJournalView::updateView()
diff --git a/korganizer/kojournalview.h b/korganizer/kojournalview.h
index aabf11c..0437d95 100644
--- a/korganizer/kojournalview.h
+++ b/korganizer/kojournalview.h
@@ -48,29 +48,30 @@ class KOJournalView : public KOrg::BaseView
48 virtual QPtrList<Incidence> selectedIncidences(); 48 virtual QPtrList<Incidence> selectedIncidences();
49 DateList selectedDates() 49 DateList selectedDates()
50 {DateList q; 50 {DateList q;
51 return q;}; 51 return q;};
52 signals: 52 signals:
53 void deleteJournal(Journal *); 53 void deleteJournal(Journal *);
54 public slots: 54 public slots:
55 void showOnly ( Journal* ); 55 void showOnly ( Journal* );
56 void newJournal(); 56 void newJournal();
57 void updateView(); 57 void updateView();
58 void flushView(); 58 void flushView();
59 void updateConfig(); 59 void updateConfig();
60 void showDates( const QDate &start, const QDate &end ); 60 void showDates( const QDate &start, const QDate &end );
61 void showEvents(QPtrList<Event> eventList); 61 void showEvents(QPtrList<Event> eventList);
62 62
63 void changeEventDisplay(Event *, int); 63 void changeEventDisplay(Event *, int);
64 64
65 private: 65 private:
66 void showList(QPtrList<Journal> jl); 66 void showList(QPtrList<Journal> jl);
67 Calendar *mCalendar; 67 Calendar *mCalendar;
68 JournalEntry* getNewEntry(); 68 JournalEntry* getNewEntry();
69 QPtrList<JournalEntry> jEntries; 69 QPtrList<JournalEntry> jEntries;
70 void keyPressEvent ( QKeyEvent * ) ; 70 void keyPressEvent ( QKeyEvent * ) ;
71 QBoxLayout *mTopLayout; 71 QBoxLayout *mTopLayout;
72 QWidget *parWid;
72 QDate mDate; 73 QDate mDate;
73 74
74}; 75};
75 76
76#endif 77#endif