summaryrefslogtreecommitdiffabout
path: root/korganizer/kojournalview.cpp
Unidiff
Diffstat (limited to 'korganizer/kojournalview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kojournalview.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/korganizer/kojournalview.cpp b/korganizer/kojournalview.cpp
index 6fa9b23..9b0e748 100644
--- a/korganizer/kojournalview.cpp
+++ b/korganizer/kojournalview.cpp
@@ -1,171 +1,171 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
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 <qscrollview.h>
29#include <qpopupmenu.h> 29#include <qpopupmenu.h>
30#include <qhbox.h> 30#include <qhbox.h>
31#include <qpushbutton.h> 31#include <qpushbutton.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qpushbutton.h> 33#include <qpushbutton.h>
34#include <qapplication.h> 34#include <qapplication.h>
35 35
36#include <klocale.h> 36#include <klocale.h>
37#include <kdebug.h> 37#include <kdebug.h>
38#include "koprefs.h" 38#include "koprefs.h"
39#include <kglobal.h> 39#include <kglobal.h>
40 40
41#include <libkcal/calendar.h> 41#include <libkcal/calendar.h>
42 42
43#include "journalentry.h" 43#include "journalentry.h"
44 44
45#include "kojournalview.h" 45#include "kojournalview.h"
46using namespace KOrg; 46using namespace KOrg;
47 47
48KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent, 48KOJournalView::KOJournalView(Calendar *calendar, QWidget *parent,
49 const char *name) 49 const char *name)
50 : KOrg::BaseView(calendar, parent, name) 50 : KOrg::BaseView(calendar, parent, name)
51{ 51{
52 mCalendar = calendar; 52 mCalendar = calendar;
53 QHBox * vb = new QHBox ( this );
54 QPushButton * newJournal = new QPushButton( vb );
55 QPixmap icon;
56 if ( QApplication::desktop()->width() < 321 )
57 icon = SmallIcon("ko16old");
58 else
59 icon = SmallIcon("ko24old");
60 newJournal->setPixmap (icon ) ;
61 int size = newJournal->sizeHint().height();
62 newJournal->setFixedSize( size, size );
63 mDateLabel = new QLabel ( vb );
64 mDateLabel->setMargin(1);
65 mDateLabel->setAlignment(AlignCenter);
53 QScrollView * sv = new QScrollView( this ); 66 QScrollView * sv = new QScrollView( this );
54 QHBoxLayout * hbl = new QHBoxLayout( this ); 67 QVBoxLayout * hbl = new QVBoxLayout( this );
68 hbl->addWidget( vb );
55 hbl->addWidget( sv ); 69 hbl->addWidget( sv );
56 parWid = new QWidget( sv->viewport() ); 70 parWid = new QWidget( sv->viewport() );
57 sv->addChild(parWid); 71 sv->addChild(parWid);
58 sv->setResizePolicy( QScrollView:: AutoOneFit ); 72 sv->setResizePolicy( QScrollView:: AutoOneFit );
59 mTopLayout = new QVBoxLayout(parWid); 73 mTopLayout = new QVBoxLayout(parWid);
60 QHBox * vb = new QHBox ( parWid ); 74 connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) );
61 QPushButton * newJournal = new QPushButton( vb ); 75 getNewEntry();
62 QPixmap icon;
63 if ( QApplication::desktop()->width() < 321 )
64 icon = SmallIcon("ko16old");
65 else
66 icon = SmallIcon("ko24old");
67 newJournal->setPixmap (icon ) ;
68 int size = newJournal->sizeHint().height();
69 newJournal->setFixedSize( size, size );
70 mDateLabel = new QLabel ( vb );
71 mTopLayout->addWidget( vb );
72 mDateLabel->setMargin(1);
73 mDateLabel->setAlignment(AlignCenter);
74 connect( newJournal, SIGNAL( clicked() ), this , SLOT( newJournal() ) );
75 getNewEntry();
76} 76}
77 77
78KOJournalView::~KOJournalView() 78KOJournalView::~KOJournalView()
79{ 79{
80} 80}
81 81
82int KOJournalView::currentDateCount() 82int KOJournalView::currentDateCount()
83{ 83{
84 return 0; 84 return 0;
85} 85}
86JournalEntry* KOJournalView::getNewEntry() 86JournalEntry* KOJournalView::getNewEntry()
87{ 87{
88 JournalEntry* Entry = new JournalEntry(mCalendar,parWid); 88 JournalEntry* Entry = new JournalEntry(mCalendar,parWid);
89 jEntries.append( Entry ); 89 jEntries.append( Entry );
90 mTopLayout->addWidget(Entry); 90 mTopLayout->addWidget(Entry);
91 Entry->setFont ( KOPrefs::instance()->mJornalViewFont ); 91 Entry->setFont ( KOPrefs::instance()->mJornalViewFont );
92 connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ; 92 connect ( Entry,SIGNAL(deleteJournal(Journal *) ),this ,SIGNAL(deleteJournal(Journal *) ) ) ;
93 connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ; 93 connect ( Entry,SIGNAL(newJournal() ),this ,SLOT(newJournal() ) ) ;
94 connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ; 94 connect ( Entry,SIGNAL(showJournalOnly( Journal * ) ),this ,SLOT(showOnly ( Journal* ) ) ) ;
95 return Entry; 95 return Entry;
96} 96}
97 97
98QPtrList<Incidence> KOJournalView::selectedIncidences() 98QPtrList<Incidence> KOJournalView::selectedIncidences()
99{ 99{
100 QPtrList<Incidence> eventList; 100 QPtrList<Incidence> eventList;
101 101
102 return eventList; 102 return eventList;
103} 103}
104void KOJournalView::updateConfig() 104void KOJournalView::updateConfig()
105{ 105{
106 JournalEntry* mEntry = jEntries.first(); 106 JournalEntry* mEntry = jEntries.first();
107 while ( mEntry ) { 107 while ( mEntry ) {
108 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 108 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
109 mEntry = jEntries.next(); 109 mEntry = jEntries.next();
110 } 110 }
111} 111}
112void KOJournalView::updateView() 112void KOJournalView::updateView()
113{ 113{
114 JournalEntry* mEntry = jEntries.first(); 114 JournalEntry* mEntry = jEntries.first();
115 while ( mEntry ) { 115 while ( mEntry ) {
116 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont ); 116 mEntry->setFont ( KOPrefs::instance()->mJornalViewFont );
117 mEntry = jEntries.next(); 117 mEntry = jEntries.next();
118 } 118 }
119 showDates( mDate, QDate() ); 119 showDates( mDate, QDate() );
120} 120}
121void KOJournalView::checkModified() 121void KOJournalView::checkModified()
122{ 122{
123 flushView(); 123 flushView();
124} 124}
125void KOJournalView::flushView() 125void KOJournalView::flushView()
126{ 126{
127 static bool ff = false; 127 static bool ff = false;
128 if ( ff ) return; 128 if ( ff ) return;
129 ff = true; 129 ff = true;
130 JournalEntry* mEntry = jEntries.first(); 130 JournalEntry* mEntry = jEntries.first();
131 while ( mEntry ) { 131 while ( mEntry ) {
132 mEntry->flushEntry(); 132 mEntry->flushEntry();
133 mEntry = jEntries.next(); 133 mEntry = jEntries.next();
134 } 134 }
135 ff = false; 135 ff = false;
136} 136}
137 137
138void KOJournalView::clearList() 138void KOJournalView::clearList()
139{ 139{
140 JournalEntry* mEntry = jEntries.first(); 140 JournalEntry* mEntry = jEntries.first();
141 while ( mEntry ) { 141 while ( mEntry ) {
142 mEntry->clear(); 142 mEntry->clear();
143 mEntry = jEntries.next(); 143 mEntry = jEntries.next();
144 } 144 }
145} 145}
146void KOJournalView::newJournal() 146void KOJournalView::newJournal()
147{ 147{
148 //qDebug(" KOJournalView::newJournal()"); 148 //qDebug(" KOJournalView::newJournal()");
149 flushView(); 149 flushView();
150 Journal* mJournal = new Journal; 150 Journal* mJournal = new Journal;
151 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); 151 mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0)));
152 mCalendar->addJournal(mJournal); 152 mCalendar->addJournal(mJournal);
153 showDates( mDate, QDate() ); 153 showDates( mDate, QDate() );
154} 154}
155 155
156void KOJournalView::showOnly ( Journal* j ) 156void KOJournalView::showOnly ( Journal* j )
157{ 157{
158 qDebug("showOnly %x ", j); 158 qDebug("showOnly %x ", j);
159 flushView(); 159 flushView();
160 if ( j == 0 ) { 160 if ( j == 0 ) {
161 showDates( mDate, QDate() ); 161 showDates( mDate, QDate() );
162 return; 162 return;
163 } 163 }
164 QPtrList<Journal> jl; 164 QPtrList<Journal> jl;
165 jl.append ( j ); 165 jl.append ( j );
166 showList( jl ); 166 showList( jl );
167 JournalEntry* mEntry = jEntries.first(); 167 JournalEntry* mEntry = jEntries.first();
168 mEntry->setShowOnly(); 168 mEntry->setShowOnly();
169} 169}
170void KOJournalView::showList(QPtrList<Journal> jl) 170void KOJournalView::showList(QPtrList<Journal> jl)
171{ 171{