-rw-r--r-- | core/pim/datebook/modules/monthview/odatebookmonth.cpp | 1 | ||||
-rw-r--r-- | noncore/settings/usermanager/userdialog.h | 3 |
2 files changed, 1 insertions, 3 deletions
diff --git a/core/pim/datebook/modules/monthview/odatebookmonth.cpp b/core/pim/datebook/modules/monthview/odatebookmonth.cpp index 5e2f1bb..d52a092 100644 --- a/core/pim/datebook/modules/monthview/odatebookmonth.cpp +++ b/core/pim/datebook/modules/monthview/odatebookmonth.cpp | |||
@@ -1,221 +1,220 @@ | |||
1 | /* this is a straight copy of datemonthview. We can not make child of | 1 | /* this is a straight copy of datemonthview. We can not make child of |
2 | * it 'cause the origin view isn't virtual in any form. | 2 | * it 'cause the origin view isn't virtual in any form. |
3 | */ | 3 | */ |
4 | /********************************************************************** | 4 | /********************************************************************** |
5 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 5 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
6 | ** | 6 | ** |
7 | ** This file is part of the Qtopia Environment. | 7 | ** This file is part of the Qtopia Environment. |
8 | ** | 8 | ** |
9 | ** This file may be distributed and/or modified under the terms of the | 9 | ** This file may be distributed and/or modified under the terms of the |
10 | ** GNU General Public License version 2 as published by the Free Software | 10 | ** GNU General Public License version 2 as published by the Free Software |
11 | ** Foundation and appearing in the file LICENSE.GPL included in the | 11 | ** Foundation and appearing in the file LICENSE.GPL included in the |
12 | ** packaging of this file. | 12 | ** packaging of this file. |
13 | ** | 13 | ** |
14 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 14 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
15 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 15 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
16 | ** | 16 | ** |
17 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 17 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
18 | ** | 18 | ** |
19 | ** Contact info@trolltech.com if any conditions of this licensing are | 19 | ** Contact info@trolltech.com if any conditions of this licensing are |
20 | ** not clear to you. | 20 | ** not clear to you. |
21 | ** | 21 | ** |
22 | **********************************************************************/ | 22 | **********************************************************************/ |
23 | #include "odatebookmonth.h" | 23 | #include "odatebookmonth.h" |
24 | #include "datebooktypes.h" | 24 | #include "datebooktypes.h" |
25 | 25 | ||
26 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
27 | #include <qpe/datebookmonth.h> | 27 | #include <qpe/datebookmonth.h> |
28 | 28 | ||
29 | #include <qpe/resource.h> | ||
30 | #include <qpe/qpeapplication.h> | 29 | #include <qpe/qpeapplication.h> |
31 | 30 | ||
32 | #include <qtoolbutton.h> | 31 | #include <qtoolbutton.h> |
33 | #include <qspinbox.h> | 32 | #include <qspinbox.h> |
34 | #include <qcombobox.h> | 33 | #include <qcombobox.h> |
35 | #include <qvaluestack.h> | 34 | #include <qvaluestack.h> |
36 | #include <qwhatsthis.h> | 35 | #include <qwhatsthis.h> |
37 | 36 | ||
38 | 37 | ||
39 | //--------------------------------------------------------------------------- | 38 | //--------------------------------------------------------------------------- |
40 | 39 | ||
41 | class ODateBookMonthTablePrivate | 40 | class ODateBookMonthTablePrivate |
42 | { | 41 | { |
43 | public: | 42 | public: |
44 | ODateBookMonthTablePrivate() {}; | 43 | ODateBookMonthTablePrivate() {}; |
45 | ~ODateBookMonthTablePrivate() { mMonthEvents.clear(); }; | 44 | ~ODateBookMonthTablePrivate() { mMonthEvents.clear(); }; |
46 | 45 | ||
47 | QValueList<EffectiveEvent> mMonthEvents; | 46 | QValueList<EffectiveEvent> mMonthEvents; |
48 | bool onMonday; | 47 | bool onMonday; |
49 | }; | 48 | }; |
50 | 49 | ||
51 | ODateBookMonthTable::ODateBookMonthTable( QWidget *parent, const char *name, | 50 | ODateBookMonthTable::ODateBookMonthTable( QWidget *parent, const char *name, |
52 | DateBookDBHoliday *newDb ) | 51 | DateBookDBHoliday *newDb ) |
53 | : QTable( 6, 7, parent, name ), | 52 | : QTable( 6, 7, parent, name ), |
54 | db( newDb ) | 53 | db( newDb ) |
55 | { | 54 | { |
56 | d = new ODateBookMonthTablePrivate(); | 55 | d = new ODateBookMonthTablePrivate(); |
57 | selYear = -1; | 56 | selYear = -1; |
58 | selMonth = -1; | 57 | selMonth = -1; |
59 | selDay = -1; | 58 | selDay = -1; |
60 | 59 | ||
61 | /* init these as well make valgrind happy and be consistent with Qtopia1.6 -zecke */ | 60 | /* init these as well make valgrind happy and be consistent with Qtopia1.6 -zecke */ |
62 | year = -1; | 61 | year = -1; |
63 | month = -1; | 62 | month = -1; |
64 | day = -1; | 63 | day = -1; |
65 | 64 | ||
66 | Config cfg( "qpe" ); | 65 | Config cfg( "qpe" ); |
67 | cfg.setGroup( "Time" ); | 66 | cfg.setGroup( "Time" ); |
68 | d->onMonday = cfg.readBoolEntry( "MONDAY" ); | 67 | d->onMonday = cfg.readBoolEntry( "MONDAY" ); |
69 | 68 | ||
70 | horizontalHeader()->setResizeEnabled( FALSE ); | 69 | horizontalHeader()->setResizeEnabled( FALSE ); |
71 | // we have to do this here... or suffer the consequences later... | 70 | // we have to do this here... or suffer the consequences later... |
72 | for ( int i = 0; i < 7; i++ ){ | 71 | for ( int i = 0; i < 7; i++ ){ |
73 | horizontalHeader()->resizeSection( i, 30 ); | 72 | horizontalHeader()->resizeSection( i, 30 ); |
74 | setColumnStretchable( i, TRUE ); | 73 | setColumnStretchable( i, TRUE ); |
75 | } | 74 | } |
76 | setupLabels(); | 75 | setupLabels(); |
77 | 76 | ||
78 | verticalHeader()->hide(); | 77 | verticalHeader()->hide(); |
79 | setLeftMargin( 0 ); | 78 | setLeftMargin( 0 ); |
80 | for ( int i = 0; i < 6; ++i ) | 79 | for ( int i = 0; i < 6; ++i ) |
81 | setRowStretchable( i, TRUE ); | 80 | setRowStretchable( i, TRUE ); |
82 | 81 | ||
83 | setSelectionMode( NoSelection ); | 82 | setSelectionMode( NoSelection ); |
84 | 83 | ||
85 | connect( this, SIGNAL( clicked(int,int,int,const QPoint&) ), | 84 | connect( this, SIGNAL( clicked(int,int,int,const QPoint&) ), |
86 | this, SLOT( dayClicked(int,int) ) ); | 85 | this, SLOT( dayClicked(int,int) ) ); |
87 | connect( this, SIGNAL( currentChanged(int,int) ), | 86 | connect( this, SIGNAL( currentChanged(int,int) ), |
88 | this, SLOT( dragDay(int,int) ) ); | 87 | this, SLOT( dragDay(int,int) ) ); |
89 | setVScrollBarMode( AlwaysOff ); | 88 | setVScrollBarMode( AlwaysOff ); |
90 | setHScrollBarMode( AlwaysOff ); | 89 | setHScrollBarMode( AlwaysOff ); |
91 | } | 90 | } |
92 | 91 | ||
93 | ODateBookMonthTable::~ODateBookMonthTable() | 92 | ODateBookMonthTable::~ODateBookMonthTable() |
94 | { | 93 | { |
95 | monthsEvents.clear(); | 94 | monthsEvents.clear(); |
96 | delete d; | 95 | delete d; |
97 | } | 96 | } |
98 | 97 | ||
99 | void ODateBookMonthTable::setDate(int y, int m, int d) | 98 | void ODateBookMonthTable::setDate(int y, int m, int d) |
100 | { | 99 | { |
101 | if (month == m && year == y) { | 100 | if (month == m && year == y) { |
102 | if ( selYear == -1 ) | 101 | if ( selYear == -1 ) |
103 | year = selYear; | 102 | year = selYear; |
104 | if ( selMonth == -1 ) | 103 | if ( selMonth == -1 ) |
105 | month = selMonth; | 104 | month = selMonth; |
106 | int r1, c1, r2, c2; | 105 | int r1, c1, r2, c2; |
107 | findDay(selDay, r1, c1); | 106 | findDay(selDay, r1, c1); |
108 | selDay = day = d; | 107 | selDay = day = d; |
109 | findDay(selDay, r2, c2); | 108 | findDay(selDay, r2, c2); |
110 | setCurrentCell( r2, c2 ); | 109 | setCurrentCell( r2, c2 ); |
111 | //updateCell(r1,c1); | 110 | //updateCell(r1,c1); |
112 | //updateCell(r2,c2); | 111 | //updateCell(r2,c2); |
113 | } else { | 112 | } else { |
114 | selYear = year = y; | 113 | selYear = year = y; |
115 | selMonth = month = m; | 114 | selMonth = month = m; |
116 | selDay = day = d; | 115 | selDay = day = d; |
117 | setupTable(); | 116 | setupTable(); |
118 | } | 117 | } |
119 | } | 118 | } |
120 | 119 | ||
121 | void ODateBookMonthTable::redraw() | 120 | void ODateBookMonthTable::redraw() |
122 | { | 121 | { |
123 | setupLabels(); | 122 | setupLabels(); |
124 | setupTable(); | 123 | setupTable(); |
125 | } | 124 | } |
126 | 125 | ||
127 | void ODateBookMonthTable::setWeekStart( bool onMonday ) | 126 | void ODateBookMonthTable::setWeekStart( bool onMonday ) |
128 | { | 127 | { |
129 | d->onMonday = onMonday; | 128 | d->onMonday = onMonday; |
130 | setupLabels(); | 129 | setupLabels(); |
131 | setupTable(); | 130 | setupTable(); |
132 | } | 131 | } |
133 | 132 | ||
134 | void ODateBookMonthTable::setupTable() | 133 | void ODateBookMonthTable::setupTable() |
135 | { | 134 | { |
136 | QValueList<Calendar::Day> days = Calendar::daysOfMonth( year, month, d->onMonday ); | 135 | QValueList<Calendar::Day> days = Calendar::daysOfMonth( year, month, d->onMonday ); |
137 | QValueList<Calendar::Day>::Iterator it = days.begin(); | 136 | QValueList<Calendar::Day>::Iterator it = days.begin(); |
138 | int row = 0, col = 0; | 137 | int row = 0, col = 0; |
139 | int crow = 0; | 138 | int crow = 0; |
140 | int ccol = 0; | 139 | int ccol = 0; |
141 | for ( ; it != days.end(); ++it ) { | 140 | for ( ; it != days.end(); ++it ) { |
142 | DayItemMonth *i = (DayItemMonth *)item( row, col ); | 141 | DayItemMonth *i = (DayItemMonth *)item( row, col ); |
143 | if ( !i ) { | 142 | if ( !i ) { |
144 | i = new DayItemMonth( this, QTableItem::Never, "" ); | 143 | i = new DayItemMonth( this, QTableItem::Never, "" ); |
145 | setItem( row, col, i ); | 144 | setItem( row, col, i ); |
146 | } | 145 | } |
147 | Calendar::Day calDay = *it; | 146 | Calendar::Day calDay = *it; |
148 | i->clearEffEvents(); | 147 | i->clearEffEvents(); |
149 | i->setDay( calDay.date ); | 148 | i->setDay( calDay.date ); |
150 | i->setType( calDay.type ); | 149 | i->setType( calDay.type ); |
151 | if ( i->day() == day && calDay.type == Calendar::Day::ThisMonth ) { | 150 | if ( i->day() == day && calDay.type == Calendar::Day::ThisMonth ) { |
152 | crow = row; | 151 | crow = row; |
153 | ccol = col; | 152 | ccol = col; |
154 | } | 153 | } |
155 | 154 | ||
156 | updateCell( row, col ); | 155 | updateCell( row, col ); |
157 | 156 | ||
158 | if ( col == 6 ) { | 157 | if ( col == 6 ) { |
159 | ++row; | 158 | ++row; |
160 | col = 0; | 159 | col = 0; |
161 | } else { | 160 | } else { |
162 | ++col; | 161 | ++col; |
163 | } | 162 | } |
164 | } | 163 | } |
165 | setCurrentCell( crow, ccol ); | 164 | setCurrentCell( crow, ccol ); |
166 | getEvents(); | 165 | getEvents(); |
167 | } | 166 | } |
168 | 167 | ||
169 | void ODateBookMonthTable::findDay( int day, int &row, int &col ) | 168 | void ODateBookMonthTable::findDay( int day, int &row, int &col ) |
170 | { | 169 | { |
171 | QDate dtBegin( year, month, 1 ); | 170 | QDate dtBegin( year, month, 1 ); |
172 | int skips = dtBegin.dayOfWeek(); | 171 | int skips = dtBegin.dayOfWeek(); |
173 | int effective_day = day + skips - 1; // row/columns begin at 0 | 172 | int effective_day = day + skips - 1; // row/columns begin at 0 |
174 | // make an extra adjustment if we start on Mondays. | 173 | // make an extra adjustment if we start on Mondays. |
175 | if ( d->onMonday ) | 174 | if ( d->onMonday ) |
176 | effective_day--; | 175 | effective_day--; |
177 | row = effective_day / 7; | 176 | row = effective_day / 7; |
178 | col = effective_day % 7; | 177 | col = effective_day % 7; |
179 | } | 178 | } |
180 | 179 | ||
181 | void ODateBookMonthTable::dayClicked( int row, int col ) | 180 | void ODateBookMonthTable::dayClicked( int row, int col ) |
182 | { | 181 | { |
183 | changeDaySelection( row, col ); | 182 | changeDaySelection( row, col ); |
184 | emit dateClicked( selYear, selMonth, selDay ); | 183 | emit dateClicked( selYear, selMonth, selDay ); |
185 | } | 184 | } |
186 | 185 | ||
187 | void ODateBookMonthTable::dragDay( int row, int col ) | 186 | void ODateBookMonthTable::dragDay( int row, int col ) |
188 | { | 187 | { |
189 | changeDaySelection( row, col ); | 188 | changeDaySelection( row, col ); |
190 | } | 189 | } |
191 | 190 | ||
192 | void ODateBookMonthTable::changeDaySelection( int row, int col ) | 191 | void ODateBookMonthTable::changeDaySelection( int row, int col ) |
193 | { | 192 | { |
194 | DayItemMonth *i = (DayItemMonth*)item( row, col ); | 193 | DayItemMonth *i = (DayItemMonth*)item( row, col ); |
195 | if ( !i ) | 194 | if ( !i ) |
196 | return; | 195 | return; |
197 | switch ( i->type() ) { | 196 | switch ( i->type() ) { |
198 | case Calendar::Day::ThisMonth: | 197 | case Calendar::Day::ThisMonth: |
199 | selMonth = month; | 198 | selMonth = month; |
200 | break; | 199 | break; |
201 | case Calendar::Day::PrevMonth: | 200 | case Calendar::Day::PrevMonth: |
202 | selMonth = month-1; | 201 | selMonth = month-1; |
203 | break; | 202 | break; |
204 | default: | 203 | default: |
205 | selMonth = month+1; | 204 | selMonth = month+1; |
206 | } | 205 | } |
207 | 206 | ||
208 | selYear = year; | 207 | selYear = year; |
209 | if ( selMonth <= 0 ) { | 208 | if ( selMonth <= 0 ) { |
210 | selMonth = 12; | 209 | selMonth = 12; |
211 | selYear--; | 210 | selYear--; |
212 | } else if ( selMonth > 12 ) { | 211 | } else if ( selMonth > 12 ) { |
213 | selMonth = 1; | 212 | selMonth = 1; |
214 | selYear++; | 213 | selYear++; |
215 | } | 214 | } |
216 | selDay = i->day(); | 215 | selDay = i->day(); |
217 | } | 216 | } |
218 | 217 | ||
219 | 218 | ||
220 | void ODateBookMonthTable::viewportMouseReleaseEvent( QMouseEvent * ) | 219 | void ODateBookMonthTable::viewportMouseReleaseEvent( QMouseEvent * ) |
221 | { | 220 | { |
diff --git a/noncore/settings/usermanager/userdialog.h b/noncore/settings/usermanager/userdialog.h index a94e49b..78cd608 100644 --- a/noncore/settings/usermanager/userdialog.h +++ b/noncore/settings/usermanager/userdialog.h | |||
@@ -1,67 +1,66 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | #ifndef USERDIALOG_H | 9 | #ifndef USERDIALOG_H |
10 | #define USERDIALOG_H | 10 | #define USERDIALOG_H |
11 | 11 | ||
12 | #include <qdialog.h> | 12 | #include <qdialog.h> |
13 | #include <qimage.h> | ||
13 | #include <qlineedit.h> | 14 | #include <qlineedit.h> |
14 | #include <qcombobox.h> | 15 | #include <qcombobox.h> |
15 | #include <qlistview.h> | 16 | #include <qlistview.h> |
16 | #include <qtabwidget.h> | 17 | #include <qtabwidget.h> |
17 | #include <qpushbutton.h> | 18 | #include <qpushbutton.h> |
18 | #include <qcheckbox.h> | 19 | #include <qcheckbox.h> |
19 | #include <qlabel.h> | 20 | #include <qlabel.h> |
20 | 21 | ||
21 | #include <qpe/resource.h> | ||
22 | |||
23 | #include <opie2/ofiledialog.h> | 22 | #include <opie2/ofiledialog.h> |
24 | 23 | ||
25 | class UserDialog : public QDialog | 24 | class UserDialog : public QDialog |
26 | { | 25 | { |
27 | Q_OBJECT | 26 | Q_OBJECT |
28 | private: | 27 | private: |
29 | QTabWidget *myTabWidget; | 28 | QTabWidget *myTabWidget; |
30 | QPushButton *picturePushButton; | 29 | QPushButton *picturePushButton; |
31 | QLineEdit *loginLineEdit; | 30 | QLineEdit *loginLineEdit; |
32 | QLineEdit *uidLineEdit; | 31 | QLineEdit *uidLineEdit; |
33 | QLineEdit *gecosLineEdit; | 32 | QLineEdit *gecosLineEdit; |
34 | QLineEdit *passwordLineEdit; | 33 | QLineEdit *passwordLineEdit; |
35 | QComboBox *shellComboBox; | 34 | QComboBox *shellComboBox; |
36 | QComboBox *groupComboBox; | 35 | QComboBox *groupComboBox; |
37 | QLabel *skelLabel; | 36 | QLabel *skelLabel; |
38 | QCheckBox *skelCheckBox; | 37 | QCheckBox *skelCheckBox; |
39 | QListView *groupsListView; | 38 | QListView *groupsListView; |
40 | 39 | ||
41 | QStringList groupMembers; | 40 | QStringList groupMembers; |
42 | QString pictureLocation; | 41 | QString pictureLocation; |
43 | QImage userImage; | 42 | QImage userImage; |
44 | int groupID; | 43 | int groupID; |
45 | int userID; | 44 | int userID; |
46 | int vm; | 45 | int vm; |
47 | enum VIEWMODE { | 46 | enum VIEWMODE { |
48 | VIEWMODE_NEW, | 47 | VIEWMODE_NEW, |
49 | VIEWMODE_EDIT | 48 | VIEWMODE_EDIT |
50 | }; | 49 | }; |
51 | 50 | ||
52 | void setupTab1(void); | 51 | void setupTab1(void); |
53 | void setupTab2(void); | 52 | void setupTab2(void); |
54 | void accept(void); | 53 | void accept(void); |
55 | 54 | ||
56 | private slots: | 55 | private slots: |
57 | void clickedPicture(void); | 56 | void clickedPicture(void); |
58 | 57 | ||
59 | public: | 58 | public: |
60 | UserDialog( int viewmode=VIEWMODE_NEW, QWidget* parent = 0, const char* name = 0, bool modal=true, WFlags fl = 0 ); | 59 | UserDialog( int viewmode=VIEWMODE_NEW, QWidget* parent = 0, const char* name = 0, bool modal=true, WFlags fl = 0 ); |
61 | ~UserDialog(); | 60 | ~UserDialog(); |
62 | static bool addUser(int uid, int gid); | 61 | static bool addUser(int uid, int gid); |
63 | static bool editUser(const char *username); | 62 | static bool editUser(const char *username); |
64 | static bool delUser(const char *username); | 63 | static bool delUser(const char *username); |
65 | }; | 64 | }; |
66 | 65 | ||
67 | #endif | 66 | #endif |