author | zautrix <zautrix> | 2005-11-12 22:23:02 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-12 22:23:02 (UTC) |
commit | 9e47202fd38512cc523c09cf8878f4c5d836e777 (patch) (unidiff) | |
tree | fa35760dc12d7176e3c2e63c22c6482601f7e59d | |
parent | f1b53f2c08c2ce384f663ae6f0a818104db8c53e (diff) | |
download | kdepimpi-9e47202fd38512cc523c09cf8878f4c5d836e777.zip kdepimpi-9e47202fd38512cc523c09cf8878f4c5d836e777.tar.gz kdepimpi-9e47202fd38512cc523c09cf8878f4c5d836e777.tar.bz2 |
fix
-rw-r--r-- | korganizer/journalentry.cpp | 16 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 3 |
2 files changed, 16 insertions, 3 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp index 7f6f221..5269af7 100644 --- a/korganizer/journalentry.cpp +++ b/korganizer/journalentry.cpp | |||
@@ -1,373 +1,385 @@ | |||
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 | // 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> | 29 | #include <qvbox.h> |
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qtextcodec.h> | 33 | #include <qtextcodec.h> |
34 | #include <qpixmap.h> | 34 | #include <qpixmap.h> |
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 | #include <klineedit.h> | 45 | #include <klineedit.h> |
46 | #include <kdialog.h> | 46 | #include <kdialog.h> |
47 | #include "kolocationbox.h" | 47 | #include "kolocationbox.h" |
48 | 48 | ||
49 | #include <libkcal/journal.h> | 49 | #include <libkcal/journal.h> |
50 | #include <libkcal/calendarresources.h> | 50 | #include <libkcal/calendarresources.h> |
51 | #include <libkcal/resourcecalendar.h> | 51 | #include <libkcal/resourcecalendar.h> |
52 | #include <kresources/resourceselectdialog.h> | 52 | #include <kresources/resourceselectdialog.h> |
53 | 53 | ||
54 | #include "journalentry.h" | 54 | #include "journalentry.h" |
55 | //#include "journalentry.moc" | 55 | //#include "journalentry.moc" |
56 | #ifndef DESKTOP_VERSION | 56 | #ifndef DESKTOP_VERSION |
57 | #include <qpe/qpeapplication.h> | 57 | #include <qpe/qpeapplication.h> |
58 | #endif | 58 | #endif |
59 | JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : | 59 | JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : |
60 | QFrame(parent) | 60 | QFrame(parent) |
61 | { | 61 | { |
62 | 62 | ||
63 | int fac = 5; | 63 | int fac = 5; |
64 | heiHint = QApplication::desktop()->height(); | 64 | heiHint = QApplication::desktop()->height(); |
65 | if ( heiHint > 800 ) | 65 | if ( heiHint > 800 ) |
66 | fac += 2; | 66 | fac += 2; |
67 | heiHint = heiHint / fac; | 67 | heiHint = heiHint / fac; |
68 | 68 | ||
69 | showOnlyMode = false; | 69 | showOnlyMode = false; |
70 | mCalendar = calendar; | 70 | mCalendar = calendar; |
71 | mJournal = 0; | 71 | mJournal = 0; |
72 | visibleMode = true; | 72 | visibleMode = true; |
73 | QHBox * vb = new QHBox ( this ); | 73 | QHBox * vb = new QHBox ( this ); |
74 | QPixmap iconp; | 74 | QPixmap iconp; |
75 | vb->setMargin ( KDialog::marginHint()-1 ); | 75 | vb->setMargin ( KDialog::marginHint()-1 ); |
76 | QPushButton * toggleJournal = new QPushButton( vb ); | 76 | QPushButton * toggleJournal = new QPushButton( vb ); |
77 | iconp = SmallIcon("1updownarrow"); | 77 | iconp = SmallIcon("1updownarrow"); |
78 | toggleJournal->setPixmap (iconp ) ; | 78 | toggleJournal->setPixmap (iconp ) ; |
79 | QLabel* textLabel = new QLabel(" "+i18n("Title: "),vb); | 79 | QLabel* textLabel = new QLabel(" "+i18n("Title: "),vb); |
80 | mTitle = new KOLocationBox(TRUE, vb, 30); | 80 | mTitle = new KOLocationBox(TRUE, vb, 30); |
81 | mTitle->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); | 81 | mTitle->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); |
82 | mCalendarBox = new QComboBox(vb); | 82 | mCalendarBox = new QComboBox(vb); |
83 | mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); | 83 | mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); |
84 | #ifndef DESKTOP_VERSION | 84 | #ifndef DESKTOP_VERSION |
85 | mTitle->setSizeLimit( 8 ); | 85 | mTitle->setSizeLimit( 8 ); |
86 | mCalendarBox->setSizeLimit( 8 ); | 86 | mCalendarBox->setSizeLimit( 8 ); |
87 | #endif | 87 | #endif |
88 | vb->setStretchFactor ( mTitle, 8 ); | 88 | vb->setStretchFactor ( mTitle, 8 ); |
89 | int limit = 3; | 89 | int limit = 3; |
90 | if ( QApplication::desktop()->width() < 640 ) | 90 | if ( QApplication::desktop()->width() < 640 ) |
91 | limit = 6; | 91 | limit = 6; |
92 | vb->setStretchFactor ( mCalendarBox, limit ); | 92 | vb->setStretchFactor ( mCalendarBox, limit ); |
93 | //mTitleLabel->setMargin(0); | 93 | //mTitleLabel->setMargin(0); |
94 | //mTitleLabel->setAlignment(AlignCenter); | 94 | //mTitleLabel->setAlignment(AlignCenter); |
95 | QPushButton * loadTemplate = new QPushButton( vb ); | 95 | QPushButton * loadTemplate = new QPushButton( vb ); |
96 | QPushButton * saveTemplate = new QPushButton( vb ); | 96 | QPushButton * saveTemplate = new QPushButton( vb ); |
97 | if ( QApplication::desktop()->width() < 321 ) | 97 | if ( QApplication::desktop()->width() < 321 ) |
98 | iconp = SmallIcon("fileexport16"); | 98 | iconp = SmallIcon("fileexport16"); |
99 | else | 99 | else |
100 | iconp = SmallIcon("fileexport"); | 100 | iconp = SmallIcon("fileexport"); |
101 | saveTemplate->setPixmap (iconp ) ; | 101 | saveTemplate->setPixmap (iconp ) ; |
102 | int size = saveTemplate->sizeHint().height(); | 102 | int size = saveTemplate->sizeHint().height(); |
103 | if ( QApplication::desktop()->width() < 321 ) | 103 | if ( QApplication::desktop()->width() < 321 ) |
104 | iconp = SmallIcon("fileimport16"); | 104 | iconp = SmallIcon("fileimport16"); |
105 | else | 105 | else |
106 | iconp = SmallIcon("fileimport"); | 106 | iconp = SmallIcon("fileimport"); |
107 | loadTemplate->setPixmap (iconp ) ; | 107 | loadTemplate->setPixmap (iconp ) ; |
108 | loadTemplate->setFixedSize( size, size ); | 108 | loadTemplate->setFixedSize( size, size ); |
109 | saveTemplate->setFixedSize( size, size ); | 109 | saveTemplate->setFixedSize( size, size ); |
110 | int widwid = size; | 110 | int widwid = size; |
111 | if ( QApplication::desktop()->width() < 320 ) | 111 | if ( QApplication::desktop()->width() < 320 ) |
112 | widwid = size/2+1; | 112 | widwid = size/2+1; |
113 | toggleJournal->setFixedSize( widwid , size ); | 113 | toggleJournal->setFixedSize( widwid , size ); |
114 | mTitle->setFixedHeight( size+4); | 114 | mTitle->setFixedHeight( size+4); |
115 | mCalendarBox->setFixedHeight( size+4); | 115 | mCalendarBox->setFixedHeight( size+4); |
116 | mEditor = new KTextEdit(this); | 116 | mEditor = new KTextEdit(this); |
117 | #ifndef DESKTOP_VERSION | 117 | #ifndef DESKTOP_VERSION |
118 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); | 118 | QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); |
119 | #endif | 119 | #endif |
120 | mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width(); | 120 | mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width(); |
121 | mDeskWid = QApplication::desktop()->width(); | 121 | mDeskWid = QApplication::desktop()->width(); |
122 | int maxwid = mDeskWid - mMaxWidDiff; | 122 | int maxwid = mDeskWid - mMaxWidDiff; |
123 | if ( QApplication::desktop()->width() < 640 ) { | 123 | if ( QApplication::desktop()->width() < 640 ) { |
124 | mTitle->setMaximumWidth( maxwid/2 +20 ); | 124 | mTitle->setMaximumWidth( maxwid/2 +20 ); |
125 | mCalendarBox->setMaximumWidth( maxwid/2 -20); | 125 | mCalendarBox->setMaximumWidth( maxwid/2 -20); |
126 | } else { | 126 | } else { |
127 | mTitle->setMaximumWidth( (maxwid/4)*3); | 127 | mTitle->setMaximumWidth( (maxwid/4)*3); |
128 | mCalendarBox->setMaximumWidth( maxwid/2 ); | 128 | mCalendarBox->setMaximumWidth( maxwid/2 ); |
129 | } | 129 | } |
130 | //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); | 130 | //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); |
131 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); | 131 | mEditor->setWordWrap( KTextEdit::WidgetWidth ); |
132 | QBoxLayout *topLayout = new QVBoxLayout(this); | 132 | QBoxLayout *topLayout = new QVBoxLayout(this); |
133 | topLayout->addWidget(vb); | 133 | topLayout->addWidget(vb); |
134 | topLayout->addWidget(mEditor); | 134 | topLayout->addWidget(mEditor); |
135 | mEditor->installEventFilter(this); | 135 | mEditor->installEventFilter(this); |
136 | installEventFilter(this); | ||
137 | mTitle->installEventFilter(this); | ||
138 | setFocusPolicy (QWidget::NoFocus); | ||
139 | |||
136 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); | 140 | connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); |
137 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); | 141 | connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); |
138 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); | 142 | connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); |
139 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); | 143 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); |
140 | mTitle->lineEdit ()->setText(""); | 144 | mTitle->lineEdit ()->setText(""); |
141 | } | 145 | } |
142 | 146 | ||
143 | JournalEntry::~JournalEntry() | 147 | JournalEntry::~JournalEntry() |
144 | { | 148 | { |
145 | //qDebug("JournalEntry::~JournalEntry() "); | 149 | //qDebug("JournalEntry::~JournalEntry() "); |
146 | } | 150 | } |
147 | void JournalEntry::resizeEvent(QResizeEvent* e ) | 151 | void JournalEntry::resizeEvent(QResizeEvent* e ) |
148 | { | 152 | { |
149 | #ifndef DESKTOP_VERSION | 153 | #ifndef DESKTOP_VERSION |
150 | 154 | ||
151 | if ( mDeskWid != QApplication::desktop()->width() ) { | 155 | if ( mDeskWid != QApplication::desktop()->width() ) { |
152 | mDeskWid == QApplication::desktop()->width(); | 156 | mDeskWid == QApplication::desktop()->width(); |
153 | int maxwid = mDeskWid - mMaxWidDiff; | 157 | int maxwid = mDeskWid - mMaxWidDiff; |
154 | if ( QApplication::desktop()->width() < 640 ) { | 158 | if ( QApplication::desktop()->width() < 640 ) { |
155 | mTitle->setMaximumWidth( maxwid/2 +20 ); | 159 | mTitle->setMaximumWidth( maxwid/2 +20 ); |
156 | mCalendarBox->setMaximumWidth( maxwid/2 -20); | 160 | mCalendarBox->setMaximumWidth( maxwid/2 -20); |
157 | } | 161 | } |
158 | else { | 162 | else { |
159 | mTitle->setMaximumWidth( (maxwid/4)*3); | 163 | mTitle->setMaximumWidth( (maxwid/4)*3); |
160 | mCalendarBox->setMaximumWidth( maxwid/2 ); | 164 | mCalendarBox->setMaximumWidth( maxwid/2 ); |
161 | } | 165 | } |
162 | //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); | 166 | //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); |
163 | } | 167 | } |
164 | //setMaximumWidth( QApplication::desktop()->width() ); | 168 | //setMaximumWidth( QApplication::desktop()->width() ); |
165 | //qDebug("MAXXX %d ", QApplication::desktop()->width()); | 169 | //qDebug("MAXXX %d ", QApplication::desktop()->width()); |
166 | #endif | 170 | #endif |
167 | QFrame::resizeEvent( e ); | 171 | QFrame::resizeEvent( e ); |
168 | } | 172 | } |
169 | QSize JournalEntry::sizeHint() const | 173 | QSize JournalEntry::sizeHint() const |
170 | { | 174 | { |
171 | return QSize ( 240, heiHint ); | 175 | return QSize ( 240, heiHint ); |
172 | } | 176 | } |
173 | void JournalEntry::slotSaveTemplate() | 177 | void JournalEntry::slotSaveTemplate() |
174 | { | 178 | { |
175 | QString fileName =locateLocal( "templates", "journals" ); | 179 | QString fileName =locateLocal( "templates", "journals" ); |
176 | QDir t_dir; | 180 | QDir t_dir; |
177 | if ( !t_dir.exists(fileName) ) | 181 | if ( !t_dir.exists(fileName) ) |
178 | t_dir.mkdir ( fileName ); | 182 | t_dir.mkdir ( fileName ); |
179 | fileName += "/journal"; | 183 | fileName += "/journal"; |
180 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); | 184 | fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); |
181 | if ( fileName.length() == 0 ) | 185 | if ( fileName.length() == 0 ) |
182 | return; | 186 | return; |
183 | 187 | ||
184 | QFile fileIn( fileName ); | 188 | QFile fileIn( fileName ); |
185 | if (!fileIn.open( IO_WriteOnly ) ) { | 189 | if (!fileIn.open( IO_WriteOnly ) ) { |
186 | KMessageBox::error( this, i18n("Error saving template file\n '%1'.") | 190 | KMessageBox::error( this, i18n("Error saving template file\n '%1'.") |
187 | .arg( fileName ) ); | 191 | .arg( fileName ) ); |
188 | return; | 192 | return; |
189 | } | 193 | } |
190 | // QString text; | 194 | // QString text; |
191 | QTextStream tsIn( &fileIn ); | 195 | QTextStream tsIn( &fileIn ); |
192 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 196 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
193 | tsIn << mEditor->text(); | 197 | tsIn << mEditor->text(); |
194 | fileIn.close(); | 198 | fileIn.close(); |
195 | } | 199 | } |
196 | void JournalEntry::slotLoadTemplate() | 200 | void JournalEntry::slotLoadTemplate() |
197 | { | 201 | { |
198 | QString fileName =locateLocal( "templates", "journals" ); | 202 | QString fileName =locateLocal( "templates", "journals" ); |
199 | QDir t_dir; | 203 | QDir t_dir; |
200 | if ( !t_dir.exists(fileName) ) | 204 | if ( !t_dir.exists(fileName) ) |
201 | t_dir.mkdir ( fileName ); | 205 | t_dir.mkdir ( fileName ); |
202 | fileName += "/journal"; | 206 | fileName += "/journal"; |
203 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); | 207 | fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); |
204 | if ( fileName.length() == 0 ) | 208 | if ( fileName.length() == 0 ) |
205 | return; | 209 | return; |
206 | QFile fileIn( fileName ); | 210 | QFile fileIn( fileName ); |
207 | if (!fileIn.open( IO_ReadOnly ) ) { | 211 | if (!fileIn.open( IO_ReadOnly ) ) { |
208 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") | 212 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") |
209 | .arg( fileName ) ); | 213 | .arg( fileName ) ); |
210 | return; | 214 | return; |
211 | } | 215 | } |
212 | QTextStream tsIn( &fileIn ); | 216 | QTextStream tsIn( &fileIn ); |
213 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); | 217 | tsIn.setCodec( QTextCodec::codecForName("utf8") ); |
214 | QString text = tsIn.read(); | 218 | QString text = tsIn.read(); |
215 | fileIn.close(); | 219 | fileIn.close(); |
216 | int line, col; | 220 | int line, col; |
217 | mEditor->getCursorPosition (& line, & col ); | 221 | mEditor->getCursorPosition (& line, & col ); |
218 | mEditor-> insertAt ( text, line, col, true ); | 222 | mEditor-> insertAt ( text, line, col, true ); |
219 | //mEditor->setIgnoreMark( true ); | 223 | //mEditor->setIgnoreMark( true ); |
220 | } | 224 | } |
221 | void JournalEntry::setDate(const QDate &date) | 225 | void JournalEntry::setDate(const QDate &date) |
222 | { | 226 | { |
223 | showOnlyMode = false; | 227 | showOnlyMode = false; |
224 | writeJournal(); | 228 | writeJournal(); |
225 | mDate = date; | 229 | mDate = date; |
226 | fillCalendar( mCalendar->defaultCalendar() ); | 230 | fillCalendar( mCalendar->defaultCalendar() ); |
227 | } | 231 | } |
228 | void JournalEntry::fillCalendar( int setToID ) | 232 | void JournalEntry::fillCalendar( int setToID ) |
229 | { | 233 | { |
230 | mCalendarBox->clear(); | 234 | mCalendarBox->clear(); |
231 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); | 235 | KopiCalendarFile * kkf = KOPrefs::instance()->mCalendars.first(); |
232 | int std = 0; | 236 | int std = 0; |
233 | int count = 0; | 237 | int count = 0; |
234 | while ( kkf ) { | 238 | while ( kkf ) { |
235 | if ( (!kkf->mErrorOnLoad &&! kkf->isReadOnly) || setToID == kkf->mCalNumber ) { | 239 | if ( (!kkf->mErrorOnLoad &&! kkf->isReadOnly) || setToID == kkf->mCalNumber ) { |
236 | if ( setToID ) { | 240 | if ( setToID ) { |
237 | if ( kkf->mCalNumber == setToID ) | 241 | if ( kkf->mCalNumber == setToID ) |
238 | std = count; | 242 | std = count; |
239 | } else { | 243 | } else { |
240 | if ( kkf->isStandard ) { | 244 | if ( kkf->isStandard ) { |
241 | std = count; | 245 | std = count; |
242 | } | 246 | } |
243 | } | 247 | } |
244 | ++count; | 248 | ++count; |
245 | mCalendarBox->insertItem( kkf->mName ); | 249 | mCalendarBox->insertItem( kkf->mName ); |
246 | } | 250 | } |
247 | kkf = KOPrefs::instance()->mCalendars.next(); | 251 | kkf = KOPrefs::instance()->mCalendars.next(); |
248 | } | 252 | } |
249 | mCalendarBox->setCurrentItem( std ); | 253 | mCalendarBox->setCurrentItem( std ); |
250 | } | 254 | } |
251 | 255 | ||
252 | void JournalEntry::toggleShowJournal() | 256 | void JournalEntry::toggleShowJournal() |
253 | { | 257 | { |
254 | if ( mEditor->text().isEmpty() && mTitle->currentText ().isEmpty() ) | 258 | if ( mEditor->text().isEmpty() && mTitle->currentText ().isEmpty() ) |
255 | return; | 259 | return; |
256 | if (!mEditor->text().isEmpty() || !mTitle->currentText ().isEmpty()) | 260 | if (!mEditor->text().isEmpty() || !mTitle->currentText ().isEmpty()) |
257 | flushEntry(); | 261 | flushEntry(); |
258 | if ( showOnlyMode ) | 262 | if ( showOnlyMode ) |
259 | emit showJournalOnly( 0 ); | 263 | emit showJournalOnly( 0 ); |
260 | else { | 264 | else { |
261 | // we have to protect mJournal from deleting if mJournal has empty text | 265 | // we have to protect mJournal from deleting if mJournal has empty text |
262 | visibleMode = false; // set to true via :setShowOnly() | 266 | visibleMode = false; // set to true via :setShowOnly() |
263 | emit showJournalOnly( mJournal ); | 267 | emit showJournalOnly( mJournal ); |
264 | //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) ); | 268 | //QTimer::singleShot( 0, this, SLOT( setVisibleOn() ) ); |
265 | } | 269 | } |
266 | } | 270 | } |
267 | void JournalEntry::setVisibleOn() | 271 | void JournalEntry::setVisibleOn() |
268 | { | 272 | { |
269 | visibleMode = true; | 273 | visibleMode = true; |
270 | } | 274 | } |
271 | void JournalEntry::setShowOnly() | 275 | void JournalEntry::setShowOnly() |
272 | { | 276 | { |
273 | showOnlyMode = true; | 277 | showOnlyMode = true; |
274 | if ( mTitle->currentText().isEmpty() ) | 278 | if ( mTitle->currentText().isEmpty() ) |
275 | mTitle->setFocus(); | 279 | mTitle->setFocus(); |
276 | else | 280 | else |
277 | mEditor->setFocus(); | 281 | mEditor->setFocus(); |
278 | } | 282 | } |
279 | void JournalEntry::setJournal(Journal *journal, bool saveJournal ) | 283 | void JournalEntry::setJournal(Journal *journal, bool saveJournal ) |
280 | { | 284 | { |
281 | if ( saveJournal ) | 285 | if ( saveJournal ) |
282 | writeJournal(); | 286 | writeJournal(); |
283 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); | 287 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); |
284 | 288 | ||
285 | mJournal = journal; | 289 | mJournal = journal; |
286 | if ( journal->isReadOnly() ) | 290 | if ( journal->isReadOnly() ) |
287 | mTitle->lineEdit ()->setText(mJournal->summary()+" ("+i18n("readonly")+")"); | 291 | mTitle->lineEdit ()->setText(mJournal->summary()+" ("+i18n("readonly")+")"); |
288 | else | 292 | else |
289 | mTitle->lineEdit ()->setText(mJournal->summary()); | 293 | mTitle->lineEdit ()->setText(mJournal->summary()); |
290 | mEditor->setText(mJournal->description()); | 294 | mEditor->setText(mJournal->description()); |
291 | mTitle->setEnabled (!journal->isReadOnly() ); | 295 | mTitle->setEnabled (!journal->isReadOnly() ); |
292 | mEditor->setReadOnly ( journal->isReadOnly() ); | 296 | mEditor->setReadOnly ( journal->isReadOnly() ); |
293 | mCalendarBox->setEnabled (!journal->isReadOnly() ); | 297 | mCalendarBox->setEnabled (!journal->isReadOnly() ); |
294 | fillCalendar( mJournal->calID() ); | 298 | fillCalendar( mJournal->calID() ); |
295 | } | 299 | } |
296 | 300 | ||
297 | Journal *JournalEntry::journal() const | 301 | Journal *JournalEntry::journal() const |
298 | { | 302 | { |
299 | return mJournal; | 303 | return mJournal; |
300 | } | 304 | } |
301 | 305 | ||
302 | 306 | ||
303 | void JournalEntry::clear() | 307 | void JournalEntry::clear() |
304 | { | 308 | { |
305 | mJournal = 0; | 309 | mJournal = 0; |
306 | mEditor->setText(""); | 310 | mEditor->setText(""); |
307 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); | 311 | mTitle->load( KOLocationBox::SUMMARYJOURNAL ); |
308 | mTitle->lineEdit ()->setText(""); | 312 | mTitle->lineEdit ()->setText(""); |
309 | } | 313 | } |
310 | 314 | ||
311 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) | 315 | bool JournalEntry::eventFilter( QObject *o, QEvent *e ) |
312 | { | 316 | { |
313 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; | 317 | // kdDebug() << "JournalEntry::event received " << e->type() << endl; |
314 | 318 | if ( isVisible() ) { | |
319 | mEditor->setFocusPolicy (QWidget::StrongFocus); | ||
320 | mTitle->setFocusPolicy (QWidget::StrongFocus); | ||
321 | } else { | ||
322 | mEditor->setFocusPolicy (QWidget::NoFocus); | ||
323 | mTitle->setFocusPolicy (QWidget::NoFocus); | ||
324 | } | ||
315 | if ( e->type() == QEvent::FocusOut ) { | 325 | if ( e->type() == QEvent::FocusOut ) { |
316 | writeJournal(); | 326 | writeJournal(); |
317 | } | 327 | } |
318 | if ( e->type() == QEvent::KeyPress ) { | 328 | if ( e->type() == QEvent::KeyPress ) { |
319 | QKeyEvent * k = (QKeyEvent *) e; | 329 | QKeyEvent * k = (QKeyEvent *) e; |
330 | if ( !isVisible() ) | ||
331 | return true; | ||
320 | if ( k->state() == Qt::ControlButton ) { | 332 | if ( k->state() == Qt::ControlButton ) { |
321 | k->ignore(); | 333 | k->ignore(); |
322 | //return true; | 334 | //return true; |
323 | } | 335 | } |
324 | } | 336 | } |
325 | 337 | ||
326 | return QFrame::eventFilter( o, e ); // standard event processing | 338 | return QFrame::eventFilter( o, e ); // standard event processing |
327 | } | 339 | } |
328 | 340 | ||
329 | void JournalEntry::writeJournal() | 341 | void JournalEntry::writeJournal() |
330 | { | 342 | { |
331 | if ( !visibleMode ) return; | 343 | if ( !visibleMode ) return; |
332 | if ( !mTitle->isEnabled() ) return; | 344 | if ( !mTitle->isEnabled() ) return; |
333 | if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) { | 345 | if (mEditor->text().isEmpty() && mTitle->currentText().isEmpty()) { |
334 | if ( mJournal ) { | 346 | if ( mJournal ) { |
335 | Journal* j = mJournal; | 347 | Journal* j = mJournal; |
336 | mJournal = 0; | 348 | mJournal = 0; |
337 | bool conf = KOPrefs::instance()->mConfirm; | 349 | bool conf = KOPrefs::instance()->mConfirm; |
338 | KOPrefs::instance()->mConfirm = false; | 350 | KOPrefs::instance()->mConfirm = false; |
339 | emit deleteJournal(j); | 351 | emit deleteJournal(j); |
340 | KOPrefs::instance()->mConfirm = conf; | 352 | KOPrefs::instance()->mConfirm = conf; |
341 | } | 353 | } |
342 | return; | 354 | return; |
343 | } | 355 | } |
344 | 356 | ||
345 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; | 357 | // kdDebug() << "JournalEntry::writeJournal()..." << endl; |
346 | 358 | ||
347 | if (!mJournal) { | 359 | if (!mJournal) { |
348 | mJournal = new Journal; | 360 | mJournal = new Journal; |
349 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); | 361 | mJournal->setDtStart(QDateTime(mDate,QTime(0,0,0))); |
350 | mCalendar->addJournal(mJournal); | 362 | mCalendar->addJournal(mJournal); |
351 | } | 363 | } |
352 | if ( mJournal->description() != mEditor->text() ) { | 364 | if ( mJournal->description() != mEditor->text() ) { |
353 | mJournal->setDescription(mEditor->text()); | 365 | mJournal->setDescription(mEditor->text()); |
354 | } | 366 | } |
355 | if ( mJournal->summary() != mTitle->currentText() ) { | 367 | if ( mJournal->summary() != mTitle->currentText() ) { |
356 | mJournal->setSummary(mTitle->currentText()); | 368 | mJournal->setSummary(mTitle->currentText()); |
357 | mTitle->save(KOLocationBox::SUMMARYJOURNAL); | 369 | mTitle->save(KOLocationBox::SUMMARYJOURNAL); |
358 | } | 370 | } |
359 | int id = KOPrefs::instance()->getCalendarID( mCalendarBox->currentText() ); | 371 | int id = KOPrefs::instance()->getCalendarID( mCalendarBox->currentText() ); |
360 | if ( mJournal->calID() != id ) { | 372 | if ( mJournal->calID() != id ) { |
361 | mJournal->setCalID( id ); | 373 | mJournal->setCalID( id ); |
362 | } | 374 | } |
363 | } | 375 | } |
364 | 376 | ||
365 | void JournalEntry::flushEntry() | 377 | void JournalEntry::flushEntry() |
366 | { | 378 | { |
367 | writeJournal(); | 379 | writeJournal(); |
368 | } | 380 | } |
369 | void JournalEntry::keyPressEvent ( QKeyEvent * e ) | 381 | void JournalEntry::keyPressEvent ( QKeyEvent * e ) |
370 | { | 382 | { |
371 | e->ignore(); | 383 | e->ignore(); |
372 | 384 | ||
373 | } | 385 | } |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 4fc1194..b378330 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -912,526 +912,527 @@ void KOListView::showDates(bool show) | |||
912 | { | 912 | { |
913 | // Shouldn't we set it to a value greater 0? When showDates is called with | 913 | // Shouldn't we set it to a value greater 0? When showDates is called with |
914 | // show == true at first, then the columnwidths are set to zero. | 914 | // show == true at first, then the columnwidths are set to zero. |
915 | static int oldColWidth1 = 0; | 915 | static int oldColWidth1 = 0; |
916 | static int oldColWidth3 = 0; | 916 | static int oldColWidth3 = 0; |
917 | 917 | ||
918 | if (!show) { | 918 | if (!show) { |
919 | oldColWidth1 = mListView->columnWidth(1); | 919 | oldColWidth1 = mListView->columnWidth(1); |
920 | oldColWidth3 = mListView->columnWidth(3); | 920 | oldColWidth3 = mListView->columnWidth(3); |
921 | mListView->setColumnWidth(1, 0); | 921 | mListView->setColumnWidth(1, 0); |
922 | mListView->setColumnWidth(3, 0); | 922 | mListView->setColumnWidth(3, 0); |
923 | } else { | 923 | } else { |
924 | mListView->setColumnWidth(1, oldColWidth1); | 924 | mListView->setColumnWidth(1, oldColWidth1); |
925 | mListView->setColumnWidth(3, oldColWidth3); | 925 | mListView->setColumnWidth(3, oldColWidth3); |
926 | } | 926 | } |
927 | mListView->repaint(); | 927 | mListView->repaint(); |
928 | } | 928 | } |
929 | 929 | ||
930 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 930 | void KOListView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
931 | const QDate &td) | 931 | const QDate &td) |
932 | { | 932 | { |
933 | #ifndef KORG_NOPRINTER | 933 | #ifndef KORG_NOPRINTER |
934 | calPrinter->preview(CalPrinter::Day, fd, td); | 934 | calPrinter->preview(CalPrinter::Day, fd, td); |
935 | #endif | 935 | #endif |
936 | } | 936 | } |
937 | 937 | ||
938 | void KOListView::showDates() | 938 | void KOListView::showDates() |
939 | { | 939 | { |
940 | showDates(true); | 940 | showDates(true); |
941 | } | 941 | } |
942 | 942 | ||
943 | void KOListView::hideDates() | 943 | void KOListView::hideDates() |
944 | { | 944 | { |
945 | showDates(false); | 945 | showDates(false); |
946 | } | 946 | } |
947 | 947 | ||
948 | void KOListView::resetFocus() | 948 | void KOListView::resetFocus() |
949 | { | 949 | { |
950 | topLevelWidget()->setActiveWindow(); | 950 | topLevelWidget()->setActiveWindow(); |
951 | topLevelWidget()->raise(); | 951 | topLevelWidget()->raise(); |
952 | mListView->setFocus(); | 952 | mListView->setFocus(); |
953 | } | 953 | } |
954 | void KOListView::updateView() | 954 | void KOListView::updateView() |
955 | { | 955 | { |
956 | mListView->setFocus(); | 956 | mListView->setFocus(); |
957 | if ( mListView->firstChild () ) { | 957 | if ( mListView->firstChild () ) { |
958 | mListView->setCurrentItem( mListView->firstChild () ); | 958 | mListView->setCurrentItem( mListView->firstChild () ); |
959 | } | 959 | } |
960 | processSelectionChange( mListView->firstChild () ); | 960 | processSelectionChange( mListView->firstChild () ); |
961 | } | 961 | } |
962 | void KOListView::updateConfig() | 962 | void KOListView::updateConfig() |
963 | { | 963 | { |
964 | 964 | ||
965 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 965 | mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
966 | updateView(); | 966 | updateView(); |
967 | 967 | ||
968 | } | 968 | } |
969 | void KOListView::setStartDate(const QDate &start) | 969 | void KOListView::setStartDate(const QDate &start) |
970 | { | 970 | { |
971 | mStartDate = start; | 971 | mStartDate = start; |
972 | } | 972 | } |
973 | 973 | ||
974 | void KOListView::showDates(const QDate &start, const QDate &end) | 974 | void KOListView::showDates(const QDate &start, const QDate &end) |
975 | { | 975 | { |
976 | clear(); | 976 | clear(); |
977 | mStartDate = start; | 977 | mStartDate = start; |
978 | QDate date = start; | 978 | QDate date = start; |
979 | while( date <= end ) { | 979 | while( date <= end ) { |
980 | addEvents(calendar()->events(date)); | 980 | addEvents(calendar()->events(date)); |
981 | addTodos(calendar()->todos(date)); | 981 | addTodos(calendar()->todos(date)); |
982 | addJournals( calendar()->journals4Date(date) ); | 982 | addJournals( calendar()->journals4Date(date) ); |
983 | date = date.addDays( 1 ); | 983 | date = date.addDays( 1 ); |
984 | } | 984 | } |
985 | //emit incidenceSelected( 0 ); | 985 | //emit incidenceSelected( 0 ); |
986 | updateView(); | 986 | updateView(); |
987 | 987 | ||
988 | } | 988 | } |
989 | 989 | ||
990 | void KOListView::addEvents(QPtrList<Event> eventList) | 990 | void KOListView::addEvents(QPtrList<Event> eventList) |
991 | { | 991 | { |
992 | 992 | ||
993 | Event *ev; | 993 | Event *ev; |
994 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 994 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
995 | addIncidence(ev); | 995 | addIncidence(ev); |
996 | } | 996 | } |
997 | if ( !mListView->currentItem() ){ | 997 | if ( !mListView->currentItem() ){ |
998 | updateView(); | 998 | updateView(); |
999 | } | 999 | } |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | void KOListView::addTodos(QPtrList<Todo> eventList) | 1002 | void KOListView::addTodos(QPtrList<Todo> eventList) |
1003 | { | 1003 | { |
1004 | Todo *ev; | 1004 | Todo *ev; |
1005 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1005 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1006 | addIncidence(ev); | 1006 | addIncidence(ev); |
1007 | } | 1007 | } |
1008 | if ( !mListView->currentItem() ){ | 1008 | if ( !mListView->currentItem() ){ |
1009 | updateView(); | 1009 | updateView(); |
1010 | } | 1010 | } |
1011 | } | 1011 | } |
1012 | void KOListView::addJournals(QPtrList<Journal> eventList) | 1012 | void KOListView::addJournals(QPtrList<Journal> eventList) |
1013 | { | 1013 | { |
1014 | Journal *ev; | 1014 | Journal *ev; |
1015 | for(ev = eventList.first(); ev; ev = eventList.next()) { | 1015 | for(ev = eventList.first(); ev; ev = eventList.next()) { |
1016 | addIncidence(ev); | 1016 | addIncidence(ev); |
1017 | } | 1017 | } |
1018 | if ( !mListView->currentItem() ){ | 1018 | if ( !mListView->currentItem() ){ |
1019 | updateView(); | 1019 | updateView(); |
1020 | } | 1020 | } |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | void KOListView::showCompletedTodos() | 1023 | void KOListView::showCompletedTodos() |
1024 | { | 1024 | { |
1025 | mForceShowCompletedTodos = true; | 1025 | mForceShowCompletedTodos = true; |
1026 | } | 1026 | } |
1027 | void KOListView::addIncidence(Incidence *incidence) | 1027 | void KOListView::addIncidence(Incidence *incidence) |
1028 | { | 1028 | { |
1029 | if ( mUidDict.find( incidence->uid() ) ) return; | 1029 | if ( mUidDict.find( incidence->uid() ) ) return; |
1030 | 1030 | ||
1031 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); | 1031 | // mListView->setFont ( KOPrefs::instance()->mListViewFont ); |
1032 | if ( incidence->typeID() == todoID ) { | 1032 | if ( incidence->typeID() == todoID ) { |
1033 | if ( ! mForceShowCompletedTodos ) { | 1033 | if ( ! mForceShowCompletedTodos ) { |
1034 | if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() ) | 1034 | if ( !KOPrefs::instance()->mShowCompletedTodo && ((Todo*)incidence)->isCompleted() ) |
1035 | return; | 1035 | return; |
1036 | } | 1036 | } |
1037 | } | 1037 | } |
1038 | mUidDict.insert( incidence->uid(), incidence ); | 1038 | mUidDict.insert( incidence->uid(), incidence ); |
1039 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); | 1039 | KOListViewItem *item = new KOListViewItem( incidence, mListView ); |
1040 | ListItemVisitor v(item, mStartDate ); | 1040 | ListItemVisitor v(item, mStartDate ); |
1041 | if (incidence->accept(v)) { | 1041 | if (incidence->accept(v)) { |
1042 | return; | 1042 | return; |
1043 | } | 1043 | } |
1044 | else delete item; | 1044 | else delete item; |
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | void KOListView::showEvents(QPtrList<Event> eventList) | 1047 | void KOListView::showEvents(QPtrList<Event> eventList) |
1048 | { | 1048 | { |
1049 | clear(); | 1049 | clear(); |
1050 | 1050 | ||
1051 | addEvents(eventList); | 1051 | addEvents(eventList); |
1052 | 1052 | ||
1053 | // After new creation of list view no events are selected. | 1053 | // After new creation of list view no events are selected. |
1054 | emit incidenceSelected( 0 ); | 1054 | emit incidenceSelected( 0 ); |
1055 | } | 1055 | } |
1056 | int KOListView::count() | 1056 | int KOListView::count() |
1057 | { | 1057 | { |
1058 | return mListView->childCount(); | 1058 | return mListView->childCount(); |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | void KOListView::changeEventDisplay(Event *event, int action) | 1061 | void KOListView::changeEventDisplay(Event *event, int action) |
1062 | { | 1062 | { |
1063 | KOListViewItem *item; | 1063 | KOListViewItem *item; |
1064 | 1064 | ||
1065 | switch(action) { | 1065 | switch(action) { |
1066 | case KOGlobals::EVENTADDED: | 1066 | case KOGlobals::EVENTADDED: |
1067 | addIncidence( event ); | 1067 | addIncidence( event ); |
1068 | break; | 1068 | break; |
1069 | case KOGlobals::EVENTEDITED: | 1069 | case KOGlobals::EVENTEDITED: |
1070 | item = getItemForEvent(event); | 1070 | item = getItemForEvent(event); |
1071 | if (item) { | 1071 | if (item) { |
1072 | ListItemVisitor v(item, mStartDate ); | 1072 | ListItemVisitor v(item, mStartDate ); |
1073 | ((Incidence*)event)->accept(v); | 1073 | ((Incidence*)event)->accept(v); |
1074 | } | 1074 | } |
1075 | break; | 1075 | break; |
1076 | case KOGlobals::EVENTDELETED: | 1076 | case KOGlobals::EVENTDELETED: |
1077 | item = getItemForEvent(event); | 1077 | item = getItemForEvent(event); |
1078 | if (item) { | 1078 | if (item) { |
1079 | mUidDict.remove( event->uid() ); | 1079 | mUidDict.remove( event->uid() ); |
1080 | delete item; | 1080 | delete item; |
1081 | } | 1081 | } |
1082 | break; | 1082 | break; |
1083 | default: | 1083 | default: |
1084 | ; | 1084 | ; |
1085 | } | 1085 | } |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | KOListViewItem *KOListView::getItemForEvent(Incidence *event) | 1088 | KOListViewItem *KOListView::getItemForEvent(Incidence *event) |
1089 | { | 1089 | { |
1090 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); | 1090 | KOListViewItem *item = (KOListViewItem *)mListView->firstChild(); |
1091 | while (item) { | 1091 | while (item) { |
1092 | if (item->data() == event) return item; | 1092 | if (item->data() == event) return item; |
1093 | item = (KOListViewItem *)item->nextSibling(); | 1093 | item = (KOListViewItem *)item->nextSibling(); |
1094 | } | 1094 | } |
1095 | return 0; | 1095 | return 0; |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | void KOListView::defaultItemAction(QListViewItem *i) | 1098 | void KOListView::defaultItemAction(QListViewItem *i) |
1099 | { | 1099 | { |
1100 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); | 1100 | KOListViewItem *item = static_cast<KOListViewItem *>( i ); |
1101 | if ( item ) defaultAction( item->data() ); | 1101 | if ( item ) defaultAction( item->data() ); |
1102 | 1102 | ||
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) | 1105 | void KOListView::popupMenu(QListViewItem *item,const QPoint &,int) |
1106 | { | 1106 | { |
1107 | mActiveItem = (KOListViewItem *)item; | 1107 | mActiveItem = (KOListViewItem *)item; |
1108 | if (mActiveItem) { | 1108 | if (mActiveItem) { |
1109 | Incidence *incidence = mActiveItem->data(); | 1109 | Incidence *incidence = mActiveItem->data(); |
1110 | mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); | 1110 | mPopupMenu->enableDefault( !mListView->hasMultiSelection( item ) ); |
1111 | mPopupMenu->showIncidencePopup(incidence); | 1111 | mPopupMenu->showIncidencePopup(incidence); |
1112 | 1112 | ||
1113 | /* | 1113 | /* |
1114 | if ( incidence && incidence->type() == "Event" ) { | 1114 | if ( incidence && incidence->type() == "Event" ) { |
1115 | Event *event = static_cast<Event *>( incidence ); | 1115 | Event *event = static_cast<Event *>( incidence ); |
1116 | mPopupMenu->showEventPopup(event); | 1116 | mPopupMenu->showEventPopup(event); |
1117 | } | 1117 | } |
1118 | */ | 1118 | */ |
1119 | } | 1119 | } |
1120 | } | 1120 | } |
1121 | 1121 | ||
1122 | void KOListView::readSettings(KConfig *config, QString setting) | 1122 | void KOListView::readSettings(KConfig *config, QString setting) |
1123 | { | 1123 | { |
1124 | // qDebug("KOListView::readSettings "); | 1124 | // qDebug("KOListView::readSettings "); |
1125 | mListView->restoreLayout(config,setting); | 1125 | mListView->restoreLayout(config,setting); |
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | void KOListView::writeSettings(KConfig *config, QString setting) | 1128 | void KOListView::writeSettings(KConfig *config, QString setting) |
1129 | { | 1129 | { |
1130 | // qDebug("KOListView::writeSettings "); | 1130 | // qDebug("KOListView::writeSettings "); |
1131 | mListView->saveLayout(config, setting); | 1131 | mListView->saveLayout(config, setting); |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | void KOListView::processSelectionChange(QListViewItem *) | 1134 | void KOListView::processSelectionChange(QListViewItem *) |
1135 | { | 1135 | { |
1136 | 1136 | ||
1137 | KOListViewItem *item = | 1137 | KOListViewItem *item = |
1138 | static_cast<KOListViewItem *>( mListView->currentItem() ); | 1138 | static_cast<KOListViewItem *>( mListView->currentItem() ); |
1139 | 1139 | ||
1140 | if ( !item ) { | 1140 | if ( !item ) { |
1141 | emit incidenceSelected( 0 ); | 1141 | emit incidenceSelected( 0 ); |
1142 | } else { | 1142 | } else { |
1143 | emit incidenceSelected( item->data() ); | 1143 | emit incidenceSelected( item->data() ); |
1144 | } | 1144 | } |
1145 | } | 1145 | } |
1146 | 1146 | ||
1147 | void KOListView::clearSelection() | 1147 | void KOListView::clearSelection() |
1148 | { | 1148 | { |
1149 | mListView->selectAll( false ); | 1149 | mListView->selectAll( false ); |
1150 | } | 1150 | } |
1151 | void KOListView::allSelection() | 1151 | void KOListView::allSelection() |
1152 | { | 1152 | { |
1153 | mListView->selectAll( true ); | 1153 | mListView->selectAll( true ); |
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | void KOListView::clear() | 1156 | void KOListView::clear() |
1157 | { | 1157 | { |
1158 | mListView->clear(); | 1158 | mListView->clear(); |
1159 | mUidDict.clear(); | 1159 | mUidDict.clear(); |
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | Incidence* KOListView::currentItem() | 1162 | Incidence* KOListView::currentItem() |
1163 | { | 1163 | { |
1164 | if ( mListView->currentItem() ) | 1164 | if ( mListView->currentItem() ) |
1165 | return ((KOListViewItem*) mListView->currentItem())->data(); | 1165 | return ((KOListViewItem*) mListView->currentItem())->data(); |
1166 | return 0; | 1166 | return 0; |
1167 | } | 1167 | } |
1168 | void KOListView::keyPressEvent ( QKeyEvent *e) | 1168 | void KOListView::keyPressEvent ( QKeyEvent *e) |
1169 | { | 1169 | { |
1170 | 1170 | ||
1171 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { | 1171 | if ( e->key() == Qt::Key_Delete || e->key() == Qt::Key_Backspace ) { |
1172 | deleteAll(); | 1172 | deleteAll(); |
1173 | return; | 1173 | return; |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | e->ignore(); | 1176 | e->ignore(); |
1177 | } | 1177 | } |
1178 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) | 1178 | void KOListViewListView::keyPressEvent ( QKeyEvent *e) |
1179 | { | 1179 | { |
1180 | 1180 | ||
1181 | switch ( e->key() ) { | 1181 | switch ( e->key() ) { |
1182 | case Qt::Key_Down: | 1182 | case Qt::Key_Down: |
1183 | if ( e->state() == ShiftButton ) { | 1183 | if ( e->state() == ShiftButton ) { |
1184 | QListViewItem* cn = currentItem(); | 1184 | QListViewItem* cn = currentItem(); |
1185 | if ( !cn ) | 1185 | if ( !cn ) |
1186 | cn = firstChild(); | 1186 | cn = firstChild(); |
1187 | if ( !cn ) | 1187 | if ( !cn ) |
1188 | return; | 1188 | return; |
1189 | while ( cn->nextSibling() ) | 1189 | while ( cn->nextSibling() ) |
1190 | cn = cn->nextSibling(); | 1190 | cn = cn->nextSibling(); |
1191 | setCurrentItem ( cn ); | 1191 | setCurrentItem ( cn ); |
1192 | ensureItemVisible ( cn ); | 1192 | ensureItemVisible ( cn ); |
1193 | 1193 | ||
1194 | e->accept(); | 1194 | e->accept(); |
1195 | return; | 1195 | return; |
1196 | } | 1196 | } |
1197 | if ( e->state() == ControlButton ) { | 1197 | if ( e->state() == ControlButton ) { |
1198 | int count = childCount (); | 1198 | int count = childCount (); |
1199 | int jump = count / 5; | 1199 | int jump = count / 5; |
1200 | QListViewItem* cn; | 1200 | QListViewItem* cn; |
1201 | cn = currentItem(); | 1201 | cn = currentItem(); |
1202 | if ( ! cn ) | 1202 | if ( ! cn ) |
1203 | return; | 1203 | return; |
1204 | if ( jump == 0 ) | 1204 | if ( jump == 0 ) |
1205 | jump = 1; | 1205 | jump = 1; |
1206 | while ( jump && cn->nextSibling() ) { | 1206 | while ( jump && cn->nextSibling() ) { |
1207 | cn = cn->nextSibling(); | 1207 | cn = cn->nextSibling(); |
1208 | --jump; | 1208 | --jump; |
1209 | } | 1209 | } |
1210 | setCurrentItem ( cn ); | 1210 | setCurrentItem ( cn ); |
1211 | ensureItemVisible ( cn ); | 1211 | ensureItemVisible ( cn ); |
1212 | 1212 | ||
1213 | } else | 1213 | } else |
1214 | QListView::keyPressEvent ( e ) ; | 1214 | QListView::keyPressEvent ( e ) ; |
1215 | e->accept(); | 1215 | e->accept(); |
1216 | break; | 1216 | break; |
1217 | 1217 | ||
1218 | case Qt::Key_Up: | 1218 | case Qt::Key_Up: |
1219 | if ( e->state() == ShiftButton ) { | 1219 | if ( e->state() == ShiftButton ) { |
1220 | QListViewItem* cn = firstChild(); | 1220 | QListViewItem* cn = firstChild(); |
1221 | if ( cn ) { | 1221 | if ( cn ) { |
1222 | setCurrentItem ( cn ); | 1222 | setCurrentItem ( cn ); |
1223 | ensureItemVisible ( cn ); | 1223 | ensureItemVisible ( cn ); |
1224 | } | 1224 | } |
1225 | e->accept(); | 1225 | e->accept(); |
1226 | return; | 1226 | return; |
1227 | } | 1227 | } |
1228 | if ( e->state() == ControlButton ) { | 1228 | if ( e->state() == ControlButton ) { |
1229 | int count = childCount (); | 1229 | int count = childCount (); |
1230 | int jump = count / 5; | 1230 | int jump = count / 5; |
1231 | QListViewItem* cn; | 1231 | QListViewItem* cn; |
1232 | cn = currentItem(); | 1232 | cn = currentItem(); |
1233 | if ( ! cn ) | 1233 | if ( ! cn ) |
1234 | return; | 1234 | return; |
1235 | if ( jump == 0 ) | 1235 | if ( jump == 0 ) |
1236 | jump = 1; | 1236 | jump = 1; |
1237 | while ( jump && cn->itemAbove ()) { | 1237 | while ( jump && cn->itemAbove ()) { |
1238 | cn = cn->itemAbove (); | 1238 | cn = cn->itemAbove (); |
1239 | --jump; | 1239 | --jump; |
1240 | } | 1240 | } |
1241 | setCurrentItem ( cn ); | 1241 | setCurrentItem ( cn ); |
1242 | ensureItemVisible ( cn ); | 1242 | ensureItemVisible ( cn ); |
1243 | } else | 1243 | } else |
1244 | QListView::keyPressEvent ( e ) ; | 1244 | QListView::keyPressEvent ( e ) ; |
1245 | e->accept(); | 1245 | e->accept(); |
1246 | break; | 1246 | break; |
1247 | case Qt::Key_I: { | 1247 | case Qt::Key_I: { |
1248 | QListViewItem* cn; | 1248 | QListViewItem* cn; |
1249 | cn = currentItem(); | 1249 | cn = currentItem(); |
1250 | if ( cn ) { | 1250 | if ( cn ) { |
1251 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1251 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1252 | if ( ci ){ | 1252 | if ( ci ){ |
1253 | //emit showIncidence( ci->data()); | 1253 | //emit showIncidence( ci->data()); |
1254 | cn = cn->nextSibling(); | 1254 | cn = cn->nextSibling(); |
1255 | if ( cn ) { | 1255 | if ( cn ) { |
1256 | setCurrentItem ( cn ); | 1256 | setCurrentItem ( cn ); |
1257 | ensureItemVisible ( cn ); | 1257 | ensureItemVisible ( cn ); |
1258 | } | 1258 | } |
1259 | emit showIncidence( ci->data()); | 1259 | emit showIncidence( ci->data()); |
1260 | } | 1260 | } |
1261 | } | 1261 | } |
1262 | e->accept(); | 1262 | e->accept(); |
1263 | } | 1263 | } |
1264 | break; | 1264 | break; |
1265 | case Qt::Key_Return: | 1265 | case Qt::Key_Return: |
1266 | case Qt::Key_Enter: | 1266 | case Qt::Key_Enter: |
1267 | { | 1267 | { |
1268 | QListViewItem* cn; | 1268 | QListViewItem* cn; |
1269 | cn = currentItem(); | 1269 | cn = currentItem(); |
1270 | if ( cn ) { | 1270 | if ( cn ) { |
1271 | KOListViewItem* ci = (KOListViewItem*)( cn ); | 1271 | KOListViewItem* ci = (KOListViewItem*)( cn ); |
1272 | if ( ci ){ | 1272 | if ( ci ){ |
1273 | if ( e->state() == ShiftButton ) | 1273 | if ( e->state() == ShiftButton ) |
1274 | ci->setSelected( false ); | 1274 | ci->setSelected( false ); |
1275 | else | 1275 | else |
1276 | ci->setSelected( true ); | 1276 | ci->setSelected( true ); |
1277 | cn = cn->nextSibling(); | 1277 | cn = cn->nextSibling(); |
1278 | if ( cn ) { | 1278 | if ( cn ) { |
1279 | setCurrentItem ( cn ); | 1279 | setCurrentItem ( cn ); |
1280 | ensureItemVisible ( cn ); | 1280 | ensureItemVisible ( cn ); |
1281 | } else { | 1281 | } else { |
1282 | emit currentChanged( ci ); | 1282 | emit currentChanged( ci ); |
1283 | } | 1283 | } |
1284 | } | 1284 | } |
1285 | } | 1285 | } |
1286 | e->accept(); | 1286 | e->accept(); |
1287 | } | 1287 | } |
1288 | break; | 1288 | break; |
1289 | default: | 1289 | default: |
1290 | e->ignore(); | 1290 | e->ignore(); |
1291 | } | 1291 | } |
1292 | } | 1292 | } |
1293 | KOListViewListView::KOListViewListView(KOListView * lv ) | 1293 | KOListViewListView::KOListViewListView(KOListView * lv ) |
1294 | : KListView( lv, "kolistlistview", false ) | 1294 | : KListView( lv, "kolistlistview", false ) |
1295 | { | 1295 | { |
1296 | mYMousePos = 0; | 1296 | mYMousePos = 0; |
1297 | setAllColumnsShowFocus( true ); | ||
1297 | mPopupTimer = new QTimer(this); | 1298 | mPopupTimer = new QTimer(this); |
1298 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); | 1299 | connect(mPopupTimer , SIGNAL(timeout()), this, SLOT(popupMenu())); |
1299 | #ifndef DESKTOP_VERSION | 1300 | #ifndef DESKTOP_VERSION |
1300 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); | 1301 | //QPEApplication::setStylusOperation(viewport(), QPEApplication::RightOnHold ); |
1301 | #endif | 1302 | #endif |
1302 | setSelectionMode( QListView::Multi ); | 1303 | setSelectionMode( QListView::Multi ); |
1303 | setMultiSelection( true); | 1304 | setMultiSelection( true); |
1304 | } | 1305 | } |
1305 | bool KOListViewListView::hasMultiSelection(QListViewItem* item) | 1306 | bool KOListViewListView::hasMultiSelection(QListViewItem* item) |
1306 | { | 1307 | { |
1307 | QListViewItem *qitem = firstChild (); | 1308 | QListViewItem *qitem = firstChild (); |
1308 | while ( qitem ) { | 1309 | while ( qitem ) { |
1309 | if ( qitem->isSelected() && item != qitem ) | 1310 | if ( qitem->isSelected() && item != qitem ) |
1310 | return true; | 1311 | return true; |
1311 | qitem = qitem->nextSibling(); | 1312 | qitem = qitem->nextSibling(); |
1312 | } | 1313 | } |
1313 | return false; | 1314 | return false; |
1314 | } | 1315 | } |
1315 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) | 1316 | void KOListViewListView::contentsMouseDoubleClickEvent(QMouseEvent *e) |
1316 | { | 1317 | { |
1317 | if (!e) return; | 1318 | if (!e) return; |
1318 | QPoint vp = contentsToViewport(e->pos()); | 1319 | QPoint vp = contentsToViewport(e->pos()); |
1319 | QListViewItem *item = itemAt(vp); | 1320 | QListViewItem *item = itemAt(vp); |
1320 | if (!item) { | 1321 | if (!item) { |
1321 | emit newEvent(); | 1322 | emit newEvent(); |
1322 | return; | 1323 | return; |
1323 | } | 1324 | } |
1324 | KListView::contentsMouseDoubleClickEvent(e); | 1325 | KListView::contentsMouseDoubleClickEvent(e); |
1325 | } | 1326 | } |
1326 | #if 0 | 1327 | #if 0 |
1327 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1328 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1328 | { | 1329 | { |
1329 | //qDebug("contentsMousePressEvent++++ "); | 1330 | //qDebug("contentsMousePressEvent++++ "); |
1330 | KListView::contentsMousePressEvent( e ); | 1331 | KListView::contentsMousePressEvent( e ); |
1331 | if ( e->button() == RightButton ) { | 1332 | if ( e->button() == RightButton ) { |
1332 | QListViewItem* ci = currentItem(); | 1333 | QListViewItem* ci = currentItem(); |
1333 | clearSelection () ; | 1334 | clearSelection () ; |
1334 | if ( ci ) | 1335 | if ( ci ) |
1335 | ci->setSelected( true ); | 1336 | ci->setSelected( true ); |
1336 | } | 1337 | } |
1337 | } | 1338 | } |
1338 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1339 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1339 | { | 1340 | { |
1340 | KListView::contentsMouseReleaseEvent(e); | 1341 | KListView::contentsMouseReleaseEvent(e); |
1341 | } | 1342 | } |
1342 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1343 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1343 | { | 1344 | { |
1344 | KListView::contentsMouseMoveEvent(e); | 1345 | KListView::contentsMouseMoveEvent(e); |
1345 | } | 1346 | } |
1346 | #endif | 1347 | #endif |
1347 | void KOListViewListView::popupMenu() | 1348 | void KOListViewListView::popupMenu() |
1348 | { | 1349 | { |
1349 | mPopupTimer->stop(); | 1350 | mPopupTimer->stop(); |
1350 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); | 1351 | QMouseEvent* e = new QMouseEvent( QEvent::MouseButtonPress, mEventPos ,mEventGlobalPos, RightButton , RightButton ); |
1351 | QApplication::postEvent( this->viewport(), e ); | 1352 | QApplication::postEvent( this->viewport(), e ); |
1352 | 1353 | ||
1353 | } | 1354 | } |
1354 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | 1355 | void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) |
1355 | { | 1356 | { |
1356 | //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); | 1357 | //qDebug("contentsMousePressEvent++++ %d %d", e->pos().y(), e->globalPos().y()); |
1357 | mYMousePos = mapToGlobal( (e->pos())).y(); | 1358 | mYMousePos = mapToGlobal( (e->pos())).y(); |
1358 | if ( e->button() == LeftButton ) { | 1359 | if ( e->button() == LeftButton ) { |
1359 | mPopupTimer->start( 600 ); | 1360 | mPopupTimer->start( 600 ); |
1360 | mEventPos = contentsToViewport(e->pos()); | 1361 | mEventPos = contentsToViewport(e->pos()); |
1361 | mEventGlobalPos = e->globalPos(); | 1362 | mEventGlobalPos = e->globalPos(); |
1362 | } | 1363 | } |
1363 | KListView::contentsMousePressEvent( e ); | 1364 | KListView::contentsMousePressEvent( e ); |
1364 | if ( e->button() == RightButton ) { | 1365 | if ( e->button() == RightButton ) { |
1365 | QListViewItem* ci = currentItem(); | 1366 | QListViewItem* ci = currentItem(); |
1366 | //clearSelection(); | 1367 | //clearSelection(); |
1367 | if ( ci ) | 1368 | if ( ci ) |
1368 | ci->setSelected( true ); | 1369 | ci->setSelected( true ); |
1369 | } | 1370 | } |
1370 | } | 1371 | } |
1371 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1372 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1372 | { | 1373 | { |
1373 | mPopupTimer->stop(); | 1374 | mPopupTimer->stop(); |
1374 | KListView::contentsMouseReleaseEvent(e); | 1375 | KListView::contentsMouseReleaseEvent(e); |
1375 | } | 1376 | } |
1376 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) | 1377 | void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) |
1377 | { | 1378 | { |
1378 | // qDebug("contentsMouseMoveEv....... "); | 1379 | // qDebug("contentsMouseMoveEv....... "); |
1379 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); | 1380 | // qDebug("start: %d current %d ",mYMousePos , mapToGlobal( (e->pos())).y() ); |
1380 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); | 1381 | int diff = mYMousePos - mapToGlobal( (e->pos())).y(); |
1381 | if ( diff < 0 ) diff = -diff; | 1382 | if ( diff < 0 ) diff = -diff; |
1382 | if ( diff > 15 ) | 1383 | if ( diff > 15 ) |
1383 | mPopupTimer->stop(); | 1384 | mPopupTimer->stop(); |
1384 | else { | 1385 | else { |
1385 | mEventPos = contentsToViewport(e->pos()); | 1386 | mEventPos = contentsToViewport(e->pos()); |
1386 | mEventGlobalPos = e->globalPos(); | 1387 | mEventGlobalPos = e->globalPos(); |
1387 | } | 1388 | } |
1388 | KListView::contentsMouseMoveEvent(e); | 1389 | KListView::contentsMouseMoveEvent(e); |
1389 | } | 1390 | } |
1390 | 1391 | ||
1391 | #define protected public | 1392 | #define protected public |
1392 | #include <qheader.h> | 1393 | #include <qheader.h> |
1393 | #undef protected | 1394 | #undef protected |
1394 | void KOListViewListView::printList() | 1395 | void KOListViewListView::printList() |
1395 | { | 1396 | { |
1396 | #ifdef DESKTOP_VERSION | 1397 | #ifdef DESKTOP_VERSION |
1397 | KOPrintPrefs pp ( this ); | 1398 | KOPrintPrefs pp ( this ); |
1398 | if (!pp.exec() ) | 1399 | if (!pp.exec() ) |
1399 | return; | 1400 | return; |
1400 | int scaleval = pp.printMode() ; | 1401 | int scaleval = pp.printMode() ; |
1401 | 1402 | ||
1402 | QPrinter printer; | 1403 | QPrinter printer; |
1403 | if (!printer.setup() ) | 1404 | if (!printer.setup() ) |
1404 | return; | 1405 | return; |
1405 | clearSelection (); | 1406 | clearSelection (); |
1406 | QPainter p; | 1407 | QPainter p; |
1407 | p.begin ( &printer ); | 1408 | p.begin ( &printer ); |
1408 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 1409 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); |
1409 | float dx, dy; | 1410 | float dx, dy; |
1410 | int wid = (m.width() * 9)/10; | 1411 | int wid = (m.width() * 9)/10; |
1411 | dx = (float) wid/(float)contentsWidth (); | 1412 | dx = (float) wid/(float)contentsWidth (); |
1412 | dy = (float)(m.height()) / (float)contentsHeight (); | 1413 | dy = (float)(m.height()) / (float)contentsHeight (); |
1413 | float scale; | 1414 | float scale; |
1414 | // scale to fit the width or height of the paper | 1415 | // scale to fit the width or height of the paper |
1415 | if ( dx < dy ) | 1416 | if ( dx < dy ) |
1416 | scale = dx; | 1417 | scale = dx; |
1417 | else | 1418 | else |
1418 | scale = dy; | 1419 | scale = dy; |
1419 | 1420 | ||
1420 | p.translate( m.width()/10,m.width()/10 ); | 1421 | p.translate( m.width()/10,m.width()/10 ); |
1421 | if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { | 1422 | if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { |
1422 | p.scale( scale, scale ); | 1423 | p.scale( scale, scale ); |
1423 | } | 1424 | } |
1424 | 1425 | ||
1425 | int cou = header()->count(); | 1426 | int cou = header()->count(); |
1426 | int iii; | 1427 | int iii; |
1427 | QRect rect ( 0,0,0, header()->height()); | 1428 | QRect rect ( 0,0,0, header()->height()); |
1428 | for ( iii = 0; iii < cou; ++iii ) { | 1429 | for ( iii = 0; iii < cou; ++iii ) { |
1429 | rect.setLeft ( header()->sectionPos( iii ) ); | 1430 | rect.setLeft ( header()->sectionPos( iii ) ); |
1430 | rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii)); | 1431 | rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii)); |
1431 | header()->paintSection ( & p, header()->mapToIndex (iii), rect ); | 1432 | header()->paintSection ( & p, header()->mapToIndex (iii), rect ); |
1432 | } | 1433 | } |
1433 | p.translate( 0, header()->height()); | 1434 | p.translate( 0, header()->height()); |
1434 | drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () ); | 1435 | drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () ); |
1435 | p.end(); | 1436 | p.end(); |
1436 | #endif | 1437 | #endif |
1437 | } | 1438 | } |