summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoeditor.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoeditor.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/kotodoeditor.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 5513e8b..9073bca 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -1,157 +1,159 @@
1/* 1/*
2 This file is part of KOrganizer. 2 This file is part of KOrganizer.
3 Copyright (c) 1997, 1998 Preston Brown 3 Copyright (c) 1997, 1998 Preston Brown
4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org> 4 Copyright (c) 2000,2001 Cornelius Schumacher <schumacher@kde.org>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or 8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
11 This program is distributed in the hope that it will be useful, 11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 15
16 You should have received a copy of the GNU General Public License 16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software 17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 19
20 As a special exception, permission is given to link this program 20 As a special exception, permission is given to link this program
21 with any edition of Qt, and distribute the resulting executable, 21 with any edition of Qt, and distribute the resulting executable,
22 without including the source code for Qt in the source distribution. 22 without including the source code for Qt in the source distribution.
23*/ 23*/
24 24
25#include <qtooltip.h> 25#include <qtooltip.h>
26#include <qframe.h> 26#include <qframe.h>
27#include <qpixmap.h> 27#include <qpixmap.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qhbox.h> 29#include <qhbox.h>
30#include <qdir.h> 30#include <qdir.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qapplication.h> 32#include <qapplication.h>
33#include <qtabwidget.h> 33#include <qtabwidget.h>
34 34
35#include <kiconloader.h> 35#include <kiconloader.h>
36#include <klocale.h> 36#include <klocale.h>
37#include <kfiledialog.h> 37#include <kfiledialog.h>
38#include <kstandarddirs.h> 38#include <kstandarddirs.h>
39#include <kmessagebox.h> 39#include <kmessagebox.h>
40 40
41#include <libkdepim/categoryselectdialog.h> 41#include <libkdepim/categoryselectdialog.h>
42#include <libkcal/calendarlocal.h> 42#include <libkcal/calendarlocal.h>
43#include <libkcal/calendarresources.h> 43#include <libkcal/calendarresources.h>
44#include <libkcal/resourcecalendar.h> 44#include <libkcal/resourcecalendar.h>
45#include <libkcal/icalformat.h> 45#include <libkcal/icalformat.h>
46#include <kresources/resourceselectdialog.h> 46#include <kresources/resourceselectdialog.h>
47#include <libkdepim/kdateedit.h> 47#include <libkdepim/kdateedit.h>
48 48
49#include "koprefs.h" 49#include "koprefs.h"
50#include "kolocationbox.h" 50#include "kolocationbox.h"
51 51
52#include "kotodoeditor.h" 52#include "kotodoeditor.h"
53extern int globalFlagBlockAgenda; 53extern int globalFlagBlockAgenda;
54 54
55KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) : 55KOTodoEditor::KOTodoEditor( Calendar *calendar, QWidget *parent ) :
56 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent ) 56 KOIncidenceEditor( i18n("Edit To-Do"), calendar, parent )
57{ 57{
58 mTodo = 0; 58 mTodo = 0;
59 mRelatedTodo = 0; 59 mRelatedTodo = 0;
60 findButton(User1)->hide(); 60 findButton(User1)->hide();
61 init(); 61 init();
62 if ( QApplication::desktop()->height() <= 240 )
63 hideButtons();
62} 64}
63 65
64KOTodoEditor::~KOTodoEditor() 66KOTodoEditor::~KOTodoEditor()
65{ 67{
66 emit dialogClose( mTodo ); 68 emit dialogClose( mTodo );
67} 69}
68 70
69void KOTodoEditor::init() 71void KOTodoEditor::init()
70{ 72{
71 setupGeneral(); 73 setupGeneral();
72 setupAttendeesTab(); 74 setupAttendeesTab();
73 setupRecurrence(); 75 setupRecurrence();
74 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence())); 76 connect(mGeneral,SIGNAL(datesChecked()),this ,SLOT(checkRecurrence()));
75 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") ); 77 mRecurrence->setDateTimeStr( i18n("<i>The recurrence is computed from the start datetime!</i>") );
76} 78}
77void KOTodoEditor::setupRecurrence() 79void KOTodoEditor::setupRecurrence()
78{ 80{
79 QFrame *topFrame = addPage( i18n("Recurrence") ); 81 QFrame *topFrame = addPage( i18n("Recurrence") );
80 QBoxLayout *topLayout = new QVBoxLayout( topFrame ); 82 QBoxLayout *topLayout = new QVBoxLayout( topFrame );
81 83
82 mRecurrence = new KOEditorRecurrence( topFrame ); 84 mRecurrence = new KOEditorRecurrence( topFrame );
83 topLayout->addWidget( mRecurrence ); 85 topLayout->addWidget( mRecurrence );
84} 86}
85 87
86void KOTodoEditor::setCategories( QString s ) 88void KOTodoEditor::setCategories( QString s )
87{ 89{
88 mGeneral->setCategories(s); 90 mGeneral->setCategories(s);
89} 91}
90void KOTodoEditor::setSecrecy( int sec ) 92void KOTodoEditor::setSecrecy( int sec )
91{ 93{
92 mGeneral->setSecrecy( sec ); 94 mGeneral->setSecrecy( sec );
93} 95}
94void KOTodoEditor::reload() 96void KOTodoEditor::reload()
95{ 97{
96 if ( mTodo ) readTodo( mTodo ); 98 if ( mTodo ) readTodo( mTodo );
97} 99}
98 100
99void KOTodoEditor::setupGeneral() 101void KOTodoEditor::setupGeneral()
100{ 102{
101 mGeneral = new KOEditorGeneralTodo(this); 103 mGeneral = new KOEditorGeneralTodo(this);
102 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); 104 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
103 105
104 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); 106 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
105 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), 107 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)),
106 // mGeneral,SLOT(setCategories(const QString &))); 108 // mGeneral,SLOT(setCategories(const QString &)));
107 109
108 if (KOPrefs::instance()->mCompactDialogs) { 110 if (KOPrefs::instance()->mCompactDialogs) {
109 QFrame *topFrame = addPage(i18n("General")); 111 QFrame *topFrame = addPage(i18n("General"));
110 112
111 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 113 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
112 if ( QApplication::desktop()->width() < 480 ) { 114 if ( QApplication::desktop()->width() < 480 ) {
113 topLayout->setMargin(marginHintSmall()); 115 topLayout->setMargin(marginHintSmall());
114 topLayout->setSpacing(spacingHintSmall()); 116 topLayout->setSpacing(spacingHintSmall());
115 } else { 117 } else {
116 topLayout->setMargin(marginHint()); 118 topLayout->setMargin(marginHint());
117 topLayout->setSpacing(spacingHint()); 119 topLayout->setSpacing(spacingHint());
118 } 120 }
119 mGeneral->initHeader(topFrame,topLayout); 121 mGeneral->initHeader(topFrame,topLayout);
120 mGeneral->initTime(topFrame,topLayout); 122 mGeneral->initTime(topFrame,topLayout);
121 mGeneral->initAlarm(topFrame,topLayout); 123 mGeneral->initAlarm(topFrame,topLayout);
122 mGeneral->enableAlarm( false ); 124 mGeneral->enableAlarm( false );
123 125
124 126
125 QBoxLayout *priorityLayout; 127 QBoxLayout *priorityLayout;
126 if ( QApplication::desktop()->width() < 500 ) 128 if ( QApplication::desktop()->width() < 500 )
127 priorityLayout = new QVBoxLayout( topLayout ); 129 priorityLayout = new QVBoxLayout( topLayout );
128 else 130 else
129 priorityLayout = new QHBoxLayout( topLayout ); 131 priorityLayout = new QHBoxLayout( topLayout );
130 QWidget* prioWidget = new QWidget (topFrame); 132 QWidget* prioWidget = new QWidget (topFrame);
131 priorityLayout->addWidget( prioWidget ); 133 priorityLayout->addWidget( prioWidget );
132 QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget); 134 QHBoxLayout* priorityLayout2 = new QHBoxLayout( prioWidget);
133 135
134 136
135 QIconSet icon; 137 QIconSet icon;
136 if ( QApplication::desktop()->width() < 321 ) 138 if ( QApplication::desktop()->width() < 321 )
137 icon = SmallIcon("fileimport16"); 139 icon = SmallIcon("fileimport16");
138 else 140 else
139 icon = SmallIcon("fileimport"); 141 icon = SmallIcon("fileimport");
140 QPushButton * loadTemplate = new QPushButton( prioWidget); 142 QPushButton * loadTemplate = new QPushButton( prioWidget);
141 loadTemplate->setIconSet (icon ) ; 143 loadTemplate->setIconSet (icon ) ;
142 int size = loadTemplate->sizeHint().height(); 144 int size = loadTemplate->sizeHint().height();
143 loadTemplate->setFixedSize( size, size ); 145 loadTemplate->setFixedSize( size, size );
144 if ( QApplication::desktop()->width() < 321 ) 146 if ( QApplication::desktop()->width() < 321 )
145 icon = SmallIcon("fileexport16"); 147 icon = SmallIcon("fileexport16");
146 else 148 else
147 icon = SmallIcon("fileexport"); 149 icon = SmallIcon("fileexport");
148 QPushButton * saveTemplate = new QPushButton( prioWidget); 150 QPushButton * saveTemplate = new QPushButton( prioWidget);
149 saveTemplate->setIconSet (icon ) ; 151 saveTemplate->setIconSet (icon ) ;
150 saveTemplate->setFixedSize( size, size ); 152 saveTemplate->setFixedSize( size, size );
151 153
152 priorityLayout2->addWidget(loadTemplate); 154 priorityLayout2->addWidget(loadTemplate);
153 priorityLayout2->addWidget(saveTemplate); 155 priorityLayout2->addWidget(saveTemplate);
154 mGeneral->initPriority(prioWidget,priorityLayout2); 156 mGeneral->initPriority(prioWidget,priorityLayout2);
155 mGeneral->initCategories( topFrame, priorityLayout ); 157 mGeneral->initCategories( topFrame, priorityLayout );
156 topLayout->addStretch(1); 158 topLayout->addStretch(1);
157 159