summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/journalentry.cpp7
-rw-r--r--korganizer/koeditorgeneral.cpp7
2 files changed, 10 insertions, 4 deletions
diff --git a/korganizer/journalentry.cpp b/korganizer/journalentry.cpp
index 739949d..5fc3f2f 100644
--- a/korganizer/journalentry.cpp
+++ b/korganizer/journalentry.cpp
@@ -1,208 +1,209 @@
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
59JournalEntry::JournalEntry(Calendar *calendar,QWidget *parent) : 59JournalEntry::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 vb->setStretchFactor (textLabel,1);
81 vb->setStretchFactor( toggleJournal, 1 );
82 mTitle = new KOLocationBox(TRUE, vb, 30); 80 mTitle = new KOLocationBox(TRUE, vb, 30);
83 mTitle->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); 81 mTitle->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
84 mCalendarBox = new QComboBox(vb); 82 mCalendarBox = new QComboBox(vb);
85 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); 83 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
86#ifndef DESKTOP_VERSION 84#ifndef DESKTOP_VERSION
87 mTitle->setSizeLimit( 8 ); 85 mTitle->setSizeLimit( 8 );
88 mCalendarBox->setSizeLimit( 8 ); 86 mCalendarBox->setSizeLimit( 8 );
89#endif 87#endif
90 vb->setStretchFactor ( mTitle, 8 ); 88 vb->setStretchFactor ( mTitle, 8 );
91 int limit = 3; 89 int limit = 3;
92 if ( QApplication::desktop()->width() < 640 ) 90 if ( QApplication::desktop()->width() < 640 )
93 limit = 6; 91 limit = 6;
94 vb->setStretchFactor ( mCalendarBox, limit ); 92 vb->setStretchFactor ( mCalendarBox, limit );
95 //mTitleLabel->setMargin(0); 93 //mTitleLabel->setMargin(0);
96 //mTitleLabel->setAlignment(AlignCenter); 94 //mTitleLabel->setAlignment(AlignCenter);
97 QPushButton * loadTemplate = new QPushButton( vb ); 95 QPushButton * loadTemplate = new QPushButton( vb );
98 QPushButton * saveTemplate = new QPushButton( vb ); 96 QPushButton * saveTemplate = new QPushButton( vb );
99 if ( QApplication::desktop()->width() < 321 ) 97 if ( QApplication::desktop()->width() < 321 )
100 iconp = SmallIcon("fileexport16"); 98 iconp = SmallIcon("fileexport16");
101 else 99 else
102 iconp = SmallIcon("fileexport"); 100 iconp = SmallIcon("fileexport");
103 saveTemplate->setPixmap (iconp ) ; 101 saveTemplate->setPixmap (iconp ) ;
104 int size = saveTemplate->sizeHint().height(); 102 int size = saveTemplate->sizeHint().height();
105 if ( QApplication::desktop()->width() < 321 ) 103 if ( QApplication::desktop()->width() < 321 )
106 iconp = SmallIcon("fileimport16"); 104 iconp = SmallIcon("fileimport16");
107 else 105 else
108 iconp = SmallIcon("fileimport"); 106 iconp = SmallIcon("fileimport");
109 loadTemplate->setPixmap (iconp ) ; 107 loadTemplate->setPixmap (iconp ) ;
110 loadTemplate->setFixedSize( size, size ); 108 loadTemplate->setFixedSize( size, size );
111 saveTemplate->setFixedSize( size, size ); 109 saveTemplate->setFixedSize( size, size );
112 toggleJournal->setFixedSize( size , size ); 110 int widwid = size;
111 if ( QApplication::desktop()->width() < 320 )
112 widwid = size/2+1;
113 toggleJournal->setFixedSize( widwid , size );
113 mTitle->setFixedHeight( size+4); 114 mTitle->setFixedHeight( size+4);
114 mCalendarBox->setFixedHeight( size+4); 115 mCalendarBox->setFixedHeight( size+4);
115 mEditor = new KTextEdit(this); 116 mEditor = new KTextEdit(this);
116#ifndef DESKTOP_VERSION 117#ifndef DESKTOP_VERSION
117 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold ); 118 QPEApplication::setStylusOperation( mEditor, QPEApplication::RightOnHold );
118#endif 119#endif
119 mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width(); 120 mMaxWidDiff = 3*size - 2*frameWidth() - textLabel->sizeHint().width();
120 mDeskWid = QApplication::desktop()->width(); 121 mDeskWid = QApplication::desktop()->width();
121 int maxwid = mDeskWid - mMaxWidDiff; 122 int maxwid = mDeskWid - mMaxWidDiff;
122 if ( QApplication::desktop()->width() < 640 ) { 123 if ( QApplication::desktop()->width() < 640 ) {
123 mTitle->setMaximumWidth( maxwid/2 +20 ); 124 mTitle->setMaximumWidth( maxwid/2 +20 );
124 mCalendarBox->setMaximumWidth( maxwid/2 -20); 125 mCalendarBox->setMaximumWidth( maxwid/2 -20);
125 } else { 126 } else {
126 mTitle->setMaximumWidth( (maxwid/4)*3); 127 mTitle->setMaximumWidth( (maxwid/4)*3);
127 mCalendarBox->setMaximumWidth( maxwid/2 ); 128 mCalendarBox->setMaximumWidth( maxwid/2 );
128 } 129 }
129 //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); 130 //mCalendarBox->setMaximumWidth( maxwid/2 -20 );
130 mEditor->setWordWrap( KTextEdit::WidgetWidth ); 131 mEditor->setWordWrap( KTextEdit::WidgetWidth );
131 QBoxLayout *topLayout = new QVBoxLayout(this); 132 QBoxLayout *topLayout = new QVBoxLayout(this);
132 topLayout->addWidget(vb); 133 topLayout->addWidget(vb);
133 topLayout->addWidget(mEditor); 134 topLayout->addWidget(mEditor);
134 mEditor->installEventFilter(this); 135 mEditor->installEventFilter(this);
135 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) ); 136 connect( saveTemplate, SIGNAL( clicked() ), this , SLOT( slotSaveTemplate() ) );
136 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) ); 137 connect( loadTemplate, SIGNAL( clicked() ), this , SLOT( slotLoadTemplate() ) );
137 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) ); 138 connect( toggleJournal, SIGNAL( clicked() ), this , SLOT( toggleShowJournal() ) );
138 mTitle->load( KOLocationBox::SUMMARYJOURNAL ); 139 mTitle->load( KOLocationBox::SUMMARYJOURNAL );
139 mTitle->lineEdit ()->setText(""); 140 mTitle->lineEdit ()->setText("");
140} 141}
141 142
142JournalEntry::~JournalEntry() 143JournalEntry::~JournalEntry()
143{ 144{
144 //qDebug("JournalEntry::~JournalEntry() "); 145 //qDebug("JournalEntry::~JournalEntry() ");
145} 146}
146void JournalEntry::resizeEvent(QResizeEvent* e ) 147void JournalEntry::resizeEvent(QResizeEvent* e )
147{ 148{
148#ifndef DESKTOP_VERSION 149#ifndef DESKTOP_VERSION
149 150
150 if ( mDeskWid != QApplication::desktop()->width() ) { 151 if ( mDeskWid != QApplication::desktop()->width() ) {
151 mDeskWid == QApplication::desktop()->width(); 152 mDeskWid == QApplication::desktop()->width();
152 int maxwid = mDeskWid - mMaxWidDiff; 153 int maxwid = mDeskWid - mMaxWidDiff;
153 if ( QApplication::desktop()->width() < 640 ) { 154 if ( QApplication::desktop()->width() < 640 ) {
154 mTitle->setMaximumWidth( maxwid/2 +20 ); 155 mTitle->setMaximumWidth( maxwid/2 +20 );
155 mCalendarBox->setMaximumWidth( maxwid/2 -20); 156 mCalendarBox->setMaximumWidth( maxwid/2 -20);
156 } 157 }
157 else { 158 else {
158 mTitle->setMaximumWidth( (maxwid/4)*3); 159 mTitle->setMaximumWidth( (maxwid/4)*3);
159 mCalendarBox->setMaximumWidth( maxwid/2 ); 160 mCalendarBox->setMaximumWidth( maxwid/2 );
160 } 161 }
161 //mCalendarBox->setMaximumWidth( maxwid/2 -20 ); 162 //mCalendarBox->setMaximumWidth( maxwid/2 -20 );
162 } 163 }
163 //setMaximumWidth( QApplication::desktop()->width() ); 164 //setMaximumWidth( QApplication::desktop()->width() );
164 //qDebug("MAXXX %d ", QApplication::desktop()->width()); 165 //qDebug("MAXXX %d ", QApplication::desktop()->width());
165#endif 166#endif
166 QFrame::resizeEvent( e ); 167 QFrame::resizeEvent( e );
167} 168}
168QSize JournalEntry::sizeHint() const 169QSize JournalEntry::sizeHint() const
169{ 170{
170 return QSize ( 240, heiHint ); 171 return QSize ( 240, heiHint );
171} 172}
172void JournalEntry::slotSaveTemplate() 173void JournalEntry::slotSaveTemplate()
173{ 174{
174 QString fileName =locateLocal( "templates", "journals" ); 175 QString fileName =locateLocal( "templates", "journals" );
175 QDir t_dir; 176 QDir t_dir;
176 if ( !t_dir.exists(fileName) ) 177 if ( !t_dir.exists(fileName) )
177 t_dir.mkdir ( fileName ); 178 t_dir.mkdir ( fileName );
178 fileName += "/journal"; 179 fileName += "/journal";
179 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this ); 180 fileName = KFileDialog::getSaveFileName( fileName , i18n("Save as Journal template"), this );
180 if ( fileName.length() == 0 ) 181 if ( fileName.length() == 0 )
181 return; 182 return;
182 183
183 QFile fileIn( fileName ); 184 QFile fileIn( fileName );
184 if (!fileIn.open( IO_WriteOnly ) ) { 185 if (!fileIn.open( IO_WriteOnly ) ) {
185 KMessageBox::error( this, i18n("Error saving template file\n '%1'.") 186 KMessageBox::error( this, i18n("Error saving template file\n '%1'.")
186 .arg( fileName ) ); 187 .arg( fileName ) );
187 return; 188 return;
188 } 189 }
189 // QString text; 190 // QString text;
190 QTextStream tsIn( &fileIn ); 191 QTextStream tsIn( &fileIn );
191 tsIn.setCodec( QTextCodec::codecForName("utf8") ); 192 tsIn.setCodec( QTextCodec::codecForName("utf8") );
192 tsIn << mEditor->text(); 193 tsIn << mEditor->text();
193 fileIn.close(); 194 fileIn.close();
194} 195}
195void JournalEntry::slotLoadTemplate() 196void JournalEntry::slotLoadTemplate()
196{ 197{
197 QString fileName =locateLocal( "templates", "journals" ); 198 QString fileName =locateLocal( "templates", "journals" );
198 QDir t_dir; 199 QDir t_dir;
199 if ( !t_dir.exists(fileName) ) 200 if ( !t_dir.exists(fileName) )
200 t_dir.mkdir ( fileName ); 201 t_dir.mkdir ( fileName );
201 fileName += "/journal"; 202 fileName += "/journal";
202 fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this ); 203 fileName = KFileDialog::getOpenFileName( fileName , i18n("Insert Journal template"), this );
203 if ( fileName.length() == 0 ) 204 if ( fileName.length() == 0 )
204 return; 205 return;
205 QFile fileIn( fileName ); 206 QFile fileIn( fileName );
206 if (!fileIn.open( IO_ReadOnly ) ) { 207 if (!fileIn.open( IO_ReadOnly ) ) {
207 KMessageBox::error( this, i18n("Error loading template file\n '%1'.") 208 KMessageBox::error( this, i18n("Error loading template file\n '%1'.")
208 .arg( fileName ) ); 209 .arg( fileName ) );
diff --git a/korganizer/koeditorgeneral.cpp b/korganizer/koeditorgeneral.cpp
index aa55d82..e601eef 100644
--- a/korganizer/koeditorgeneral.cpp
+++ b/korganizer/koeditorgeneral.cpp
@@ -32,193 +32,198 @@
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qregexp.h> 34#include <qregexp.h>
35 35
36 36
37#include <kglobal.h> 37#include <kglobal.h>
38#include <kdialog.h> 38#include <kdialog.h>
39#include <kdebug.h> 39#include <kdebug.h>
40#include <klocale.h> 40#include <klocale.h>
41#include <kiconloader.h> 41#include <kiconloader.h>
42#include <kmessagebox.h> 42#include <kmessagebox.h>
43#include <kfiledialog.h> 43#include <kfiledialog.h>
44#include <kstandarddirs.h> 44#include <kstandarddirs.h>
45 45
46#include <libkcal/todo.h> 46#include <libkcal/todo.h>
47#include <libkcal/event.h> 47#include <libkcal/event.h>
48#include <libkdepim/categoryselectdialog.h> 48#include <libkdepim/categoryselectdialog.h>
49#include <libkdepim/kdateedit.h> 49#include <libkdepim/kdateedit.h>
50 50
51#include "koprefs.h" 51#include "koprefs.h"
52#include "koglobals.h" 52#include "koglobals.h"
53 53
54#include "koeditorgeneral.h" 54#include "koeditorgeneral.h"
55#include "kolocationbox.h" 55#include "kolocationbox.h"
56#ifndef DESKTOP_VERSION 56#ifndef DESKTOP_VERSION
57#include <qpe/qpeapplication.h> 57#include <qpe/qpeapplication.h>
58#else 58#else
59#include <qapplication.h> 59#include <qapplication.h>
60#endif 60#endif
61 61
62KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) : 62KOEditorGeneral::KOEditorGeneral(QObject* parent, const char* name) :
63 QObject( parent, name) 63 QObject( parent, name)
64{ 64{
65 mNextFocus = 0; 65 mNextFocus = 0;
66} 66}
67 67
68KOEditorGeneral::~KOEditorGeneral() 68KOEditorGeneral::~KOEditorGeneral()
69{ 69{
70} 70}
71 71
72void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout) 72void KOEditorGeneral::initHeader(QWidget *parent,QBoxLayout *topLayout)
73{ 73{
74 QGridLayout *headerLayout = new QGridLayout(topLayout); 74 QGridLayout *headerLayout = new QGridLayout(topLayout);
75 75
76#if 0 76#if 0
77 mOwnerLabel = new QLabel(i18n("Owner:"),parent); 77 mOwnerLabel = new QLabel(i18n("Owner:"),parent);
78 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1); 78 headerLayout->addMultiCellWidget(mOwnerLabel,0,0,0,1);
79#endif 79#endif
80 // 1 on pda 80 // 1 on pda
81 // 11 on desktop 81 // 11 on desktop
82 headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 ); 82 headerLayout->setSpacing( (KDialog::spacingHint()-3)*2+1 );
83 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent); 83 QLabel *summaryLabel = new QLabel(i18n("Summary:"),parent);
84 headerLayout->addWidget(summaryLabel,0,0); 84 headerLayout->addWidget(summaryLabel,0,0);
85 85
86 mSummaryEdit = new KOLocationBox(TRUE,parent, 50); 86 mSummaryEdit = new KOLocationBox(TRUE,parent, 50);
87 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 87 mSummaryEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
88 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) ); 88 //mSummaryEdit->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5 ,(QSizePolicy::SizeType)3 ,FALSE) );
89 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() ); 89 //qDebug("h %d %d ", summaryLabel->sizeHint().height(),mSummaryEdit->sizeHint().height() );
90 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2; 90 int hei = (summaryLabel->sizeHint().height() + mSummaryEdit->sizeHint().height())/2;
91 if ( QApplication::desktop()->width() > 320 ) 91 if ( QApplication::desktop()->width() > 320 )
92 mSummaryEdit->setMaximumHeight( hei +6 ); 92 mSummaryEdit->setMaximumHeight( hei +6 );
93 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding ); 93 //qDebug("%d %d %d %d %d %d ", QSizePolicy::Fixed , QSizePolicy::Minimum , QSizePolicy:: Maximum , QSizePolicy:: Preferred , QSizePolicy:: MinimumExpanding , QSizePolicy::Expanding );
94 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink } 94 // SizeType { Fixed = 0, Minimum = MayGrow, Maximum = MayShrink, Preferred = MayGrow|MayShrink, MinimumExpanding = Minimum|ExpMask, Expanding = MinimumExpanding|MayShrink }
95 // mSummaryEdit = new QLineEdit(parent); 95 // mSummaryEdit = new QLineEdit(parent);
96 if ( QApplication::desktop()->height() < 320 ) 96 if ( QApplication::desktop()->height() < 320 )
97 headerLayout->addWidget(mSummaryEdit,0,1); 97 headerLayout->addWidget(mSummaryEdit,0,1);
98 else 98 else
99 headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2); 99 headerLayout->addMultiCellWidget(mSummaryEdit,0,0,1,2);
100 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 100 connect ( mSummaryEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
101 101
102 QLabel *locationLabel = new QLabel(i18n("Location:"),parent); 102 QLabel *locationLabel = new QLabel(i18n("Location:"),parent);
103 if ( QApplication::desktop()->height() < 320 ) 103 if ( QApplication::desktop()->height() < 320 )
104 headerLayout->addWidget(locationLabel,0,2); 104 headerLayout->addWidget(locationLabel,0,2);
105 else 105 else
106 headerLayout->addWidget(locationLabel,1,0); 106 headerLayout->addWidget(locationLabel,1,0);
107 107
108 mLocationEdit = new KOLocationBox(TRUE,parent,30); 108 mLocationEdit = new KOLocationBox(TRUE,parent,30);
109 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 109 mLocationEdit->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
110 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 ) 110 if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->height() > 240 )
111 mLocationEdit->setMaximumHeight( hei + 6); 111 mLocationEdit->setMaximumHeight( hei + 6);
112 112
113 // mLocationEdit = new QLineEdit(parent); 113 // mLocationEdit = new QLineEdit(parent);
114 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) ); 114 connect ( mLocationEdit->lineEdit(), SIGNAL ( returnPressed() ), this, SIGNAL (allAccepted () ) );
115 115
116 mCalendarBox = new QComboBox ( parent ); 116 mCalendarBox = new QComboBox ( parent );
117 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) ); 117 mCalendarBox->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::MinimumExpanding ,FALSE) );
118 if ( QApplication::desktop()->height() < 320 ) { 118 if ( QApplication::desktop()->height() < 320 ) {
119 headerLayout->addWidget(mLocationEdit,0,3); 119 headerLayout->addWidget(mLocationEdit,0,3);
120 headerLayout->addWidget(mCalendarBox,0,4); 120 headerLayout->addWidget(mCalendarBox,0,4);
121 headerLayout->setColStretch( 1, 10); 121 headerLayout->setColStretch( 1, 10);
122 headerLayout->setColStretch( 3, 10); 122 headerLayout->setColStretch( 3, 10);
123 mCalendarBox->setMaximumWidth( 64 ); 123 mCalendarBox->setMaximumWidth( 64 );
124 } 124 }
125 else { 125 else {
126 headerLayout->addWidget(mLocationEdit,1,1); 126 headerLayout->addWidget(mLocationEdit,1,1);
127 headerLayout->addWidget(mCalendarBox,1,2); 127 headerLayout->addWidget(mCalendarBox,1,2);
128 headerLayout->setColStretch( 1, 3); 128 int str = 3;
129 if ( QApplication::desktop()->width() < 320 ) {
130 --str;
131 --str;
132 }
133 headerLayout->setColStretch( 1, str);
129 headerLayout->setColStretch( 2, 1); 134 headerLayout->setColStretch( 2, 1);
130 } 135 }
131 136
132} 137}
133void KOEditorGeneral::setFocusOn( int i ) 138void KOEditorGeneral::setFocusOn( int i )
134{ 139{
135 mNextFocus = i; 140 mNextFocus = i;
136 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() )); 141 QTimer::singleShot( 0, this, SLOT ( slotSetFocusOn() ));
137} 142}
138void KOEditorGeneral::slotSetFocusOn() 143void KOEditorGeneral::slotSetFocusOn()
139{ 144{
140 mNextFocus; 145 mNextFocus;
141 if ( mNextFocus == 1 ) { 146 if ( mNextFocus == 1 ) {
142 mDescriptionEdit->setFocus(); 147 mDescriptionEdit->setFocus();
143 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333); 148 mDescriptionEdit->setCursorPosition( mDescriptionEdit->numLines (), 333);
144 } 149 }
145 if ( mNextFocus == 2 ) { 150 if ( mNextFocus == 2 ) {
146 mSummaryEdit->setFocus(); 151 mSummaryEdit->setFocus();
147 } 152 }
148} 153}
149void KOEditorGeneral::editCategories() 154void KOEditorGeneral::editCategories()
150{ 155{
151 // qDebug("KOEditorGeneral::editCategories() "); 156 // qDebug("KOEditorGeneral::editCategories() ");
152 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 ); 157 KPIM::CategorySelectDialog* csd = new KPIM::CategorySelectDialog( KOPrefs::instance(), 0 );
153 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &))); 158 connect(csd,SIGNAL(categoriesSelected(const QString &)), this ,SLOT(setCategories(const QString &)));
154 //KOGlobals::fitDialogToScreen( csd ); 159 //KOGlobals::fitDialogToScreen( csd );
155 csd->setColorEnabled(); 160 csd->setColorEnabled();
156 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) ); 161 csd->setSelected( QStringList::split (",", mCategoriesLabel->text()) );
157 csd->exec(); 162 csd->exec();
158 delete csd; 163 delete csd;
159} 164}
160 165
161void KOEditorGeneral::showCatPopup() 166void KOEditorGeneral::showCatPopup()
162{ 167{
163 mCatPopup->clear(); 168 mCatPopup->clear();
164 QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text()); 169 QStringList checkedCategories = QStringList::split (",", mCategoriesLabel->text());
165 int index = 0; 170 int index = 0;
166 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin (); 171 for (QStringList::Iterator it = KOPrefs::instance()->mCustomCategories.begin ();
167 it != KOPrefs::instance()->mCustomCategories.end (); 172 it != KOPrefs::instance()->mCustomCategories.end ();
168 ++it) { 173 ++it) {
169 mCatPopup->insertItem (*it, index ); 174 mCatPopup->insertItem (*it, index );
170 //mCategory[index] = *it; 175 //mCategory[index] = *it;
171 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true); 176 if (checkedCategories.find (*it) != checkedCategories.end ()) mCatPopup->setItemChecked (index, true);
172 ++index; 177 ++index;
173 } 178 }
174} 179}
175void KOEditorGeneral::selectedCatPopup( int index ) 180void KOEditorGeneral::selectedCatPopup( int index )
176{ 181{
177 QStringList categories = QStringList::split (",", mCategoriesLabel->text()); 182 QStringList categories = QStringList::split (",", mCategoriesLabel->text());
178 QString colcat = categories.first(); 183 QString colcat = categories.first();
179 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ()) 184 if (categories.find (KOPrefs::instance()->mCustomCategories[index]) != categories.end ())
180 categories.remove (KOPrefs::instance()->mCustomCategories[index]); 185 categories.remove (KOPrefs::instance()->mCustomCategories[index]);
181 else 186 else
182 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]); 187 categories.insert (categories.end(), KOPrefs::instance()->mCustomCategories[index]);
183 categories.sort (); 188 categories.sort ();
184 if ( !colcat.isEmpty() ) { 189 if ( !colcat.isEmpty() ) {
185 if ( categories.find ( colcat ) != categories.end () ) { 190 if ( categories.find ( colcat ) != categories.end () ) {
186 categories.remove( colcat ); 191 categories.remove( colcat );
187 categories.prepend( colcat ); 192 categories.prepend( colcat );
188 } 193 }
189 } 194 }
190 setCategories( categories.join(",") ); 195 setCategories( categories.join(",") );
191} 196}
192 197
193void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout) 198void KOEditorGeneral::initCategories(QWidget *parent, QBoxLayout *topLayout)
194{ 199{
195 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout ); 200 QBoxLayout *categoriesLayout = new QHBoxLayout( topLayout );
196 mCatPopup = new QPopupMenu ( parent ); 201 mCatPopup = new QPopupMenu ( parent );
197 mCatPopup->setCheckable (true); 202 mCatPopup->setCheckable (true);
198 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup())); 203 connect(mCatPopup,SIGNAL(aboutToShow () ), this ,SLOT(showCatPopup()));
199 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int ))); 204 connect(mCatPopup,SIGNAL( activated ( int ) ), this ,SLOT(selectedCatPopup( int )));
200 mCategoriesButton = new QPushButton(parent); 205 mCategoriesButton = new QPushButton(parent);
201 mCategoriesButton->setText(i18n("Categories...")); 206 mCategoriesButton->setText(i18n("Categories..."));
202 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 207 connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
203 //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() )); 208 //connect(mCategoriesButton,SIGNAL(clicked()),this, SLOT(editCategories() ));
204 categoriesLayout->addWidget(mCategoriesButton); 209 categoriesLayout->addWidget(mCategoriesButton);
205 mCategoriesLabel = new QPushButton(parent);//new QLabel(parent); 210 mCategoriesLabel = new QPushButton(parent);//new QLabel(parent);
206 mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) ); 211 mCategoriesLabel->setSizePolicy( QSizePolicy( QSizePolicy::Preferred ,QSizePolicy::Fixed ,FALSE) );
207 mCategoriesLabel->setPopup( mCatPopup ); 212 mCategoriesLabel->setPopup( mCatPopup );
208 //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken); 213 //mCategoriesLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);
209 categoriesLayout->addWidget(mCategoriesLabel,1); 214 categoriesLayout->addWidget(mCategoriesLabel,1);
210} 215}
211 216
212void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout) 217void KOEditorGeneral::initSecrecy(QWidget *parent, QBoxLayout *topLayout)
213{ 218{
214 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout ); 219 QBoxLayout *secrecyLayout = new QHBoxLayout( topLayout );
215 220
216 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent); 221 QLabel *secrecyLabel = new QLabel(i18n("Access:"),parent);
217 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent); 222 mCancelBox = new QCheckBox ( i18n("Cancelled"), parent);
218 secrecyLayout->addWidget(mCancelBox); 223 secrecyLayout->addWidget(mCancelBox);
219 secrecyLayout->addWidget(secrecyLabel); 224 secrecyLayout->addWidget(secrecyLabel);
220 225
221 mSecrecyCombo = new QComboBox(parent); 226 mSecrecyCombo = new QComboBox(parent);
222 mSecrecyCombo->insertStringList(Incidence::secrecyList()); 227 mSecrecyCombo->insertStringList(Incidence::secrecyList());
223 secrecyLayout->addWidget(mSecrecyCombo); 228 secrecyLayout->addWidget(mSecrecyCombo);
224} 229}