as_assist.cpp

changeset 8
91d017614dde
parent 1
d64aaa7d146f
child 12
ceb4ba3d2d00
equal deleted inserted replaced
0:2605b96813ec 1:9dbc74cdc750
1 // 1 //
2 // OSSP asgui - Accounting system graphical user interface 2 // OSSP asgui - Accounting system graphical user interface
3 // Copyright (c) 2002-2004 The OSSP Project (http://www.ossp.org/) 3 // Copyright (c) 2002-2008 The OSSP Project (http://www.ossp.org/)
4 // Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com> 4 // Copyright (c) 2002-2008 Ralf S. Engelschall <rse@engelschall.com>
5 // Copyright (c) 2002-2004 Michael Schloh von Bennewitz <michael@schloh.com> 5 // Copyright (c) 2002-2008 Michael Schloh von Bennewitz <michael@schloh.com>
6 // Copyright (c) 2002-2004 Cable & Wireless Telecommunications Services GmbH 6 // Copyright (c) 2002-2008 Cable & Wireless Telecommunications Services GmbH
7 // 7 //
8 // This file is part of OSSP asgui, an accounting system graphical user 8 // This file is part of OSSP asgui, an accounting system graphical user
9 // interface which can be found at http://www.ossp.org/pkg/tool/asgui/. 9 // interface which can be found at http://asgui.europalab.com/.
10 // 10 //
11 // Permission to use, copy, modify, and distribute this software for 11 // Permission to use, copy, modify, and distribute this software for
12 // any purpose with or without fee is hereby granted, provided that 12 // any purpose with or without fee is hereby granted, provided that
13 // the above copyright notice and this permission notice appear in all 13 // the above copyright notice and this permission notice appear in all
14 // copies. 14 // copies.
27 // SUCH DAMAGE. 27 // SUCH DAMAGE.
28 // 28 //
29 // as_assist.cpp: ISO C++ implementation 29 // as_assist.cpp: ISO C++ implementation
30 // 30 //
31 31
32 #define QT3_SUPPORT
33
34 #include <Qt3Support>
35
32 // Qt style headers 36 // Qt style headers
33 #include <qcdestyle.h> 37 #include <qcdestyle.h>
34 #include <qsgistyle.h> 38 #include <qcleanlooksstyle.h>
39 #include <qcommonstyle.h>
35 #include <qmotifstyle.h> 40 #include <qmotifstyle.h>
36 #include <qmotifplusstyle.h> 41 #include <qplastiquestyle.h>
37 #include <qplatinumstyle.h> 42 #include <qwindowscestyle.h>
43 #include <qwindowsmobilestyle.h>
38 #include <qwindowsstyle.h> 44 #include <qwindowsstyle.h>
45 #include <qwindowsvistastyle.h>
46 #include <qwindowsxpstyle.h>
39 47
40 // Qt general headers 48 // Qt general headers
41 #include <qtooltip.h> 49 #include <qtooltip.h>
42 #include <qwhatsthis.h> 50 #include <q3whatsthis.h>
43 #include <qstringlist.h> 51 #include <qstringlist.h>
44 #include <qpopupmenu.h> 52 #include <q3popupmenu.h>
45 #include <qcombobox.h> 53 #include <qcombobox.h>
46 #include <qlistbox.h> 54 #include <q3listbox.h>
47 #include <qstatusbar.h> 55 #include <qstatusbar.h>
48 #include <qmenubar.h> 56 #include <qmenubar.h>
49 #include <qcursor.h> 57 #include <qcursor.h>
50 #include <qaction.h> 58 #include <qaction.h>
51 #include <qrect.h> 59 #include <qrect.h>
52 #include <qdir.h> 60 #include <qdir.h>
61
62 //Added by qt3to4:
63 #include <QLabel>
64 #include <QPixmap>
65 #include <Q3TextStream>
66 #include <Q3HBoxLayout>
67 #include <Q3VBoxLayout>
68 #include <Q3Frame>
53 69
54 // User interface 70 // User interface
55 #include "as_amount.h" // AmountBox class 71 #include "as_amount.h" // AmountBox class
56 #include "as_user.h" // User class 72 #include "as_user.h" // User class
57 #include "as_const.h" // Application constants 73 #include "as_const.h" // Application constants
95 // 111 //
96 void Titraqform::setupPrefs(void) 112 void Titraqform::setupPrefs(void)
97 { 113 {
98 // Can't bootstrap until we know who is using our tool, so find out 114 // Can't bootstrap until we know who is using our tool, so find out
99 User Localuser = User(); 115 User Localuser = User();
100 QString Username = Localuser.getName(); 116 QString Username = QString::fromStdString(Localuser.getName());
101 QString Homedir = Localuser.getHomedir(); 117 QString Homedir = QString::fromStdString(Localuser.getHomedir());
102 118
103 // Bootstrap a user preferences object from operating system info 119 // Bootstrap a user preferences object from operating system info
104 m_pPrefs = new Preferences(Homedir + QChar('/') + 120 m_pPrefs = new Preferences(Homedir + QChar('/') +
105 QString::fromLocal8Bit(TITRAQ_PREFNAME), 121 QString::fromLocal8Bit(TITRAQ_PREFNAME),
106 QString::fromLocal8Bit(TITRAQ_APPTITLE), 122 QString::fromLocal8Bit(TITRAQ_APPTITLE),
139 m_pPrefs->setNumber(TITRAQ_PREFLIGHTBLUE, TITRAQ_DEFLIGHTBLUE); 155 m_pPrefs->setNumber(TITRAQ_PREFLIGHTBLUE, TITRAQ_DEFLIGHTBLUE);
140 m_pPrefs->setNumber(TITRAQ_PREFDARKRED, TITRAQ_DEFDARKRED); 156 m_pPrefs->setNumber(TITRAQ_PREFDARKRED, TITRAQ_DEFDARKRED);
141 m_pPrefs->setNumber(TITRAQ_PREFDARKGREEN, TITRAQ_DEFDARKGREEN); 157 m_pPrefs->setNumber(TITRAQ_PREFDARKGREEN, TITRAQ_DEFDARKGREEN);
142 m_pPrefs->setNumber(TITRAQ_PREFDARKBLUE, TITRAQ_DEFDARKBLUE); 158 m_pPrefs->setNumber(TITRAQ_PREFDARKBLUE, TITRAQ_DEFDARKBLUE);
143 m_pPrefs->flush(); // Write the new conf file 159 m_pPrefs->flush(); // Write the new conf file
144 QTextStream cerr(stderr, IO_WriteOnly); 160 Q3TextStream cerr(stderr, QIODevice::WriteOnly);
145 cerr << trUtf8("Created new preferences file ") << Homedir << QChar('/') 161 cerr << trUtf8("Created new preferences file ") << Homedir << QChar('/')
146 << QString::fromLocal8Bit(TITRAQ_PREFNAME) << endl; 162 << QString::fromLocal8Bit(TITRAQ_PREFNAME) << endl;
147 } 163 }
148 164
149 // Use the preferred configuration values to initialize titraq 165 // Use the preferred configuration values to initialize titraq
150 switch (m_pPrefs->getNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE)) { 166 switch (m_pPrefs->getNumber(TITRAQ_PREFSTYLE, TITRAQ_STYLECDE)) {
151 case TITRAQ_STYLECDE: 167 case TITRAQ_STYLECDE:
152 qApp->setStyle(new QCDEStyle); 168 qApp->setStyle(new QCDEStyle);
153 break; 169 break;
154 case TITRAQ_STYLESGI: 170 //case TITRAQ_STYLESGI: // SGI Style is unsupported
155 qApp->setStyle(new QSGIStyle); 171 // qApp->setStyle(new QSGIStyle);
156 break; 172 // break;
157 case TITRAQ_STYLEMOTIF: 173 case TITRAQ_STYLEMOTIF:
158 qApp->setStyle(new QMotifStyle); 174 qApp->setStyle(new QMotifStyle);
159 break; 175 break;
160 case TITRAQ_STYLEMPLUS: 176 //case TITRAQ_STYLEMPLUS: // MotifPlus Style is unsupported
161 qApp->setStyle(new QMotifPlusStyle); 177 // qApp->setStyle(new QMotifPlusStyle);
162 break; 178 // break;
163 case TITRAQ_STYLEPLAT: 179 //case TITRAQ_STYLEPLAT: // Platinum Style is unsupported
164 qApp->setStyle(new QPlatinumStyle); 180 // qApp->setStyle(new QPlatinumStyle);
165 break; 181 // break;
166 case TITRAQ_STYLEMSOFT: 182 case TITRAQ_STYLEMSOFT:
167 qApp->setStyle(new QWindowsStyle); 183 qApp->setStyle(new QWindowsStyle);
168 break; 184 break;
169 default: 185 default:
170 qApp->setStyle(new QCDEStyle); 186 qApp->setStyle(new QCDEStyle);
175 // 191 //
176 // Construct various actions 192 // Construct various actions
177 // 193 //
178 void Titraqform::setupActions(void) 194 void Titraqform::setupActions(void)
179 { 195 {
180 QIconSet Saveiset, Cutiset, Copyiset, Pasteiset; 196 QIcon Saveiset, Cutiset, Copyiset, Pasteiset;
181 QIconSet Rowaddiset, Rowdeliset, Refreshiset; 197 QIcon Rowaddiset, Rowdeliset, Refreshiset;
182 QIconSet Synciset, Reportiset; 198 QIcon Synciset, Reportiset;
183 199
184 // Construct iconsets to use later for multistate action images 200 // Construct iconsets to use later for multistate action images
185 Saveiset.setPixmap(QPixmap(s_kpcFilesave_xpm), QIconSet::Automatic, QIconSet::Normal); 201 Saveiset.setPixmap(QPixmap(s_kpcFilesave_xpm), QIcon::Automatic, QIcon::Normal);
186 Saveiset.setPixmap(QPixmap(s_kpcDfilesave_xpm), QIconSet::Automatic, QIconSet::Disabled); 202 Saveiset.setPixmap(QPixmap(s_kpcDfilesave_xpm), QIcon::Automatic, QIcon::Disabled);
187 Cutiset.setPixmap(QPixmap(s_kpcCut_xpm), QIconSet::Automatic, QIconSet::Normal); 203 Cutiset.setPixmap(QPixmap(s_kpcCut_xpm), QIcon::Automatic, QIcon::Normal);
188 Cutiset.setPixmap(QPixmap(s_kpcDcut_xpm), QIconSet::Automatic, QIconSet::Disabled); 204 Cutiset.setPixmap(QPixmap(s_kpcDcut_xpm), QIcon::Automatic, QIcon::Disabled);
189 Copyiset.setPixmap(QPixmap(s_kpcCopy_xpm), QIconSet::Automatic, QIconSet::Normal); 205 Copyiset.setPixmap(QPixmap(s_kpcCopy_xpm), QIcon::Automatic, QIcon::Normal);
190 Copyiset.setPixmap(QPixmap(s_kpcDcopy_xpm), QIconSet::Automatic, QIconSet::Disabled); 206 Copyiset.setPixmap(QPixmap(s_kpcDcopy_xpm), QIcon::Automatic, QIcon::Disabled);
191 Pasteiset.setPixmap(QPixmap(s_kpcPaste_xpm), QIconSet::Automatic, QIconSet::Normal); 207 Pasteiset.setPixmap(QPixmap(s_kpcPaste_xpm), QIcon::Automatic, QIcon::Normal);
192 Pasteiset.setPixmap(QPixmap(s_kpcDpaste_xpm), QIconSet::Automatic, QIconSet::Disabled); 208 Pasteiset.setPixmap(QPixmap(s_kpcDpaste_xpm), QIcon::Automatic, QIcon::Disabled);
193 Rowaddiset.setPixmap(QPixmap(s_kpcRowadd_xpm), QIconSet::Automatic, QIconSet::Normal); 209 Rowaddiset.setPixmap(QPixmap(s_kpcRowadd_xpm), QIcon::Automatic, QIcon::Normal);
194 Rowaddiset.setPixmap(QPixmap(s_kpcDrowadd_xpm), QIconSet::Automatic, QIconSet::Disabled); 210 Rowaddiset.setPixmap(QPixmap(s_kpcDrowadd_xpm), QIcon::Automatic, QIcon::Disabled);
195 Rowdeliset.setPixmap(QPixmap(s_kpcRowdel_xpm), QIconSet::Automatic, QIconSet::Normal); 211 Rowdeliset.setPixmap(QPixmap(s_kpcRowdel_xpm), QIcon::Automatic, QIcon::Normal);
196 Rowdeliset.setPixmap(QPixmap(s_kpcDrowdel_xpm), QIconSet::Automatic, QIconSet::Disabled); 212 Rowdeliset.setPixmap(QPixmap(s_kpcDrowdel_xpm), QIcon::Automatic, QIcon::Disabled);
197 Refreshiset.setPixmap(QPixmap(s_kpcRefresh_xpm), QIconSet::Automatic, QIconSet::Normal); 213 Refreshiset.setPixmap(QPixmap(s_kpcRefresh_xpm), QIcon::Automatic, QIcon::Normal);
198 Refreshiset.setPixmap(QPixmap(s_kpcDrefresh_xpm), QIconSet::Automatic, QIconSet::Disabled); 214 Refreshiset.setPixmap(QPixmap(s_kpcDrefresh_xpm), QIcon::Automatic, QIcon::Disabled);
199 Synciset.setPixmap(QPixmap(s_kpcSync_xpm), QIconSet::Automatic, QIconSet::Normal); 215 Synciset.setPixmap(QPixmap(s_kpcSync_xpm), QIcon::Automatic, QIcon::Normal);
200 Synciset.setPixmap(QPixmap(s_kpcDsync_xpm), QIconSet::Automatic, QIconSet::Disabled); 216 Synciset.setPixmap(QPixmap(s_kpcDsync_xpm), QIcon::Automatic, QIcon::Disabled);
201 Reportiset.setPixmap(QPixmap(s_kpcReport_xpm), QIconSet::Automatic, QIconSet::Normal); 217 Reportiset.setPixmap(QPixmap(s_kpcReport_xpm), QIcon::Automatic, QIcon::Normal);
202 Reportiset.setPixmap(QPixmap(s_kpcDreport_xpm), QIconSet::Automatic, QIconSet::Disabled); 218 Reportiset.setPixmap(QPixmap(s_kpcDreport_xpm), QIcon::Automatic, QIcon::Disabled);
203 219
204 // First associate the graphics with MIME types 220 // First associate the graphics with MIME types
205 QMimeSourceFactory::defaultFactory()->setPixmap("osspicon", QPixmap(s_kpcOsspicon_xpm)); 221 Q3MimeSourceFactory::defaultFactory()->setPixmap("osspicon", QPixmap(s_kpcOsspicon_xpm));
206 QMimeSourceFactory::defaultFactory()->setPixmap("filenew", QPixmap(s_kpcFilenew_xpm)); 222 Q3MimeSourceFactory::defaultFactory()->setPixmap("filenew", QPixmap(s_kpcFilenew_xpm));
207 QMimeSourceFactory::defaultFactory()->setPixmap("fileopen", QPixmap(s_kpcFileopen_xpm)); 223 Q3MimeSourceFactory::defaultFactory()->setPixmap("fileopen", QPixmap(s_kpcFileopen_xpm));
208 QMimeSourceFactory::defaultFactory()->setPixmap("filesave", QPixmap(s_kpcFilesave_xpm)); 224 Q3MimeSourceFactory::defaultFactory()->setPixmap("filesave", QPixmap(s_kpcFilesave_xpm));
209 QMimeSourceFactory::defaultFactory()->setPixmap("cut", QPixmap(s_kpcCut_xpm)); 225 Q3MimeSourceFactory::defaultFactory()->setPixmap("cut", QPixmap(s_kpcCut_xpm));
210 QMimeSourceFactory::defaultFactory()->setPixmap("copy", QPixmap(s_kpcCopy_xpm)); 226 Q3MimeSourceFactory::defaultFactory()->setPixmap("copy", QPixmap(s_kpcCopy_xpm));
211 QMimeSourceFactory::defaultFactory()->setPixmap("paste", QPixmap(s_kpcPaste_xpm)); 227 Q3MimeSourceFactory::defaultFactory()->setPixmap("paste", QPixmap(s_kpcPaste_xpm));
212 QMimeSourceFactory::defaultFactory()->setPixmap("rowadd", QPixmap(s_kpcRowadd_xpm)); 228 Q3MimeSourceFactory::defaultFactory()->setPixmap("rowadd", QPixmap(s_kpcRowadd_xpm));
213 QMimeSourceFactory::defaultFactory()->setPixmap("rowdel", QPixmap(s_kpcRowdel_xpm)); 229 Q3MimeSourceFactory::defaultFactory()->setPixmap("rowdel", QPixmap(s_kpcRowdel_xpm));
214 QMimeSourceFactory::defaultFactory()->setPixmap("refresh", QPixmap(s_kpcRefresh_xpm)); 230 Q3MimeSourceFactory::defaultFactory()->setPixmap("refresh", QPixmap(s_kpcRefresh_xpm));
215 QMimeSourceFactory::defaultFactory()->setPixmap("syncrpc", QPixmap(s_kpcSync_xpm)); 231 Q3MimeSourceFactory::defaultFactory()->setPixmap("syncrpc", QPixmap(s_kpcSync_xpm));
216 QMimeSourceFactory::defaultFactory()->setPixmap("locreport", QPixmap(s_kpcReport_xpm)); 232 Q3MimeSourceFactory::defaultFactory()->setPixmap("locreport", QPixmap(s_kpcReport_xpm));
217 QMimeSourceFactory::defaultFactory()->setPixmap("prefs", QPixmap(s_kpcPrefs_xpm)); 233 Q3MimeSourceFactory::defaultFactory()->setPixmap("prefs", QPixmap(s_kpcPrefs_xpm));
218 234
219 // File new action 235 // File new action
220 m_pFilenewact = new QAction(trUtf8("New File"), QPixmap(s_kpcFilenew_xpm), trUtf8("&New"), CTRL+Key_N, this, "New"); 236 m_pFilenewact = new Q3Action(trUtf8("New File"), QPixmap(s_kpcFilenew_xpm), trUtf8("&New"), Qt::CTRL+Qt::Key_N, this, "New");
221 if (m_pFilenewact == NULL) // Sanity check 237 if (m_pFilenewact == NULL) // Sanity check
222 throw Genexcept("Main window file new action creation failed."); 238 throw Genexcept("Main window file new action creation failed.");
223 connect(m_pFilenewact, SIGNAL(activated()), SLOT(newDoc())); 239 connect(m_pFilenewact, SIGNAL(activated()), SLOT(newDoc()));
224 const char *kszFilenewtext = "<p><img source=\"filenew\"> " 240 const char *kszFilenewtext = "<p><img source=\"filenew\"> "
225 "Click this button to make a " 241 "Click this button to make a "
227 "select the <b>New</b> command from " 243 "select the <b>New</b> command from "
228 "the <b>File</b> menu.</p>"; 244 "the <b>File</b> menu.</p>";
229 m_pFilenewact->setWhatsThis(kszFilenewtext); 245 m_pFilenewact->setWhatsThis(kszFilenewtext);
230 246
231 // File open action 247 // File open action
232 m_pFileopenact = new QAction(trUtf8("Open File"), QPixmap(s_kpcFileopen_xpm), trUtf8("&Open..."), CTRL+Key_O, this, "Open"); 248 m_pFileopenact = new Q3Action(trUtf8("Open File"), QPixmap(s_kpcFileopen_xpm), trUtf8("&Open..."), Qt::CTRL+Qt::Key_O, this, "Open");
233 if (m_pFileopenact == NULL) // Sanity check 249 if (m_pFileopenact == NULL) // Sanity check
234 throw Genexcept("Main window file open action creation failed."); 250 throw Genexcept("Main window file open action creation failed.");
235 connect(m_pFileopenact, SIGNAL(activated()), SLOT(openDoc())); 251 connect(m_pFileopenact, SIGNAL(activated()), SLOT(openDoc()));
236 const char *kszFileopentext = "<p><img source=\"fileopen\"> " 252 const char *kszFileopentext = "<p><img source=\"fileopen\"> "
237 "Click this button to open a " 253 "Click this button to open a "
239 "the <b>Open</b> command from the " 255 "the <b>Open</b> command from the "
240 "<b>File</b> menu.</p>"; 256 "<b>File</b> menu.</p>";
241 m_pFileopenact->setWhatsThis(kszFileopentext); 257 m_pFileopenact->setWhatsThis(kszFileopentext);
242 258
243 // File save current action 259 // File save current action
244 m_pFilesaveact = new QAction(trUtf8("Save File"), Saveiset, trUtf8("&Save"), CTRL+Key_S, this, "Save"); 260 m_pFilesaveact = new Q3Action(trUtf8("Save File"), Saveiset, trUtf8("&Save"), Qt::CTRL+Qt::Key_S, this, "Save");
245 if (m_pFilesaveact == NULL) // Sanity check 261 if (m_pFilesaveact == NULL) // Sanity check
246 throw Genexcept("Main window file save action creation failed."); 262 throw Genexcept("Main window file save action creation failed.");
247 connect(m_pFilesaveact, SIGNAL(activated()), SLOT(saveFile())); 263 connect(m_pFilesaveact, SIGNAL(activated()), SLOT(saveFile()));
248 const char *kszFilesavetext = "<p><img source=\"filesave\"> " 264 const char *kszFilesavetext = "<p><img source=\"filesave\"> "
249 "Click this button to <em>save</em> " 265 "Click this button to <em>save</em> "
252 "select the<b> Save</b> command from " 268 "select the<b> Save</b> command from "
253 "the <b>File</b> menu.</p>"; 269 "the <b>File</b> menu.</p>";
254 m_pFilesaveact->setWhatsThis(kszFilesavetext); 270 m_pFilesaveact->setWhatsThis(kszFilesavetext);
255 271
256 // File save selected action 272 // File save selected action
257 m_pFilesaveasact = new QAction(trUtf8("Save File As"), trUtf8("Save &As..."), 0, this, "SaveAs"); 273 m_pFilesaveasact = new Q3Action(trUtf8("Save File As"), trUtf8("Save &As..."), 0, this, "SaveAs");
258 if (m_pFilesaveasact == NULL) // Sanity check 274 if (m_pFilesaveasact == NULL) // Sanity check
259 throw Genexcept("Main window file save as action creation failed."); 275 throw Genexcept("Main window file save as action creation failed.");
260 connect(m_pFilesaveasact, SIGNAL(activated()), SLOT(saveAs())); 276 connect(m_pFilesaveasact, SIGNAL(activated()), SLOT(saveAs()));
261 m_pFilesaveasact->setWhatsThis(kszFilesavetext); 277 m_pFilesaveasact->setWhatsThis(kszFilesavetext);
262 278
263 // File close current action 279 // File close current action
264 m_pFilecloseact = new QAction(trUtf8("Close"), trUtf8("&Close"), CTRL+Key_W, this, "Close"); 280 m_pFilecloseact = new Q3Action(trUtf8("Close"), trUtf8("&Close"), Qt::CTRL+Qt::Key_W, this, "Close");
265 if (m_pFilecloseact == NULL) // Sanity check 281 if (m_pFilecloseact == NULL) // Sanity check
266 throw Genexcept("Main window file close action creation failed."); 282 throw Genexcept("Main window file close action creation failed.");
267 connect(m_pFilecloseact, SIGNAL(activated()), SLOT(close())); 283 connect(m_pFilecloseact, SIGNAL(activated()), SLOT(close()));
268 284
269 // File quit action 285 // File quit action
270 m_pFilequitact = new QAction(trUtf8("Exit"), trUtf8("E&xit"), CTRL+Key_Q, this, "Exit"); 286 m_pFilequitact = new Q3Action(trUtf8("Exit"), trUtf8("E&xit"), Qt::CTRL+Qt::Key_Q, this, "Exit");
271 if (m_pFilequitact == NULL) // Sanity check 287 if (m_pFilequitact == NULL) // Sanity check
272 throw Genexcept("Main window file quit action creation failed."); 288 throw Genexcept("Main window file quit action creation failed.");
273 connect(m_pFilequitact, SIGNAL(activated()), SLOT(quitApp())); 289 connect(m_pFilequitact, SIGNAL(activated()), SLOT(quitApp()));
274 290
275 // Cut action 291 // Cut action
276 m_pCutact = new QAction(trUtf8("Cut"), Cutiset, trUtf8("&Cut"), CTRL+Key_X, this, "Cut"); 292 m_pCutact = new Q3Action(trUtf8("Cut"), Cutiset, trUtf8("&Cut"), Qt::CTRL+Qt::Key_X, this, "Cut");
277 if (m_pCutact == NULL) // Sanity check 293 if (m_pCutact == NULL) // Sanity check
278 throw Genexcept("Main window cut edit action creation failed."); 294 throw Genexcept("Main window cut edit action creation failed.");
279 connect(m_pCutact, SIGNAL(activated()), SLOT(cutEntry())); 295 connect(m_pCutact, SIGNAL(activated()), SLOT(cutEntry()));
280 const char *kszCuttext = "<p><img source=\"cut\"> " 296 const char *kszCuttext = "<p><img source=\"cut\"> "
281 "Click this button to cut an <em>entry</em>. " 297 "Click this button to cut an <em>entry</em>. "
282 "You can also select the <b>Cut</b> command " 298 "You can also select the <b>Cut</b> command "
283 "from the <b>Edit</b> menu.</p>"; 299 "from the <b>Edit</b> menu.</p>";
284 m_pCutact->setWhatsThis(kszCuttext); 300 m_pCutact->setWhatsThis(kszCuttext);
285 301
286 // Copy action 302 // Copy action
287 m_pCopyact = new QAction(trUtf8("Copy"), Copyiset, trUtf8("&Copy"), CTRL+Key_C, this, "Copy"); 303 m_pCopyact = new Q3Action(trUtf8("Copy"), Copyiset, trUtf8("&Copy"), Qt::CTRL+Qt::Key_C, this, "Copy");
288 if (m_pCopyact == NULL) // Sanity check 304 if (m_pCopyact == NULL) // Sanity check
289 throw Genexcept("Main window copy edit action creation failed."); 305 throw Genexcept("Main window copy edit action creation failed.");
290 connect(m_pCopyact, SIGNAL(activated()), SLOT(copyEntry())); 306 connect(m_pCopyact, SIGNAL(activated()), SLOT(copyEntry()));
291 const char *kszCopytext = "<p><img source=\"copy\"> " 307 const char *kszCopytext = "<p><img source=\"copy\"> "
292 "Click this button to copy an <em>entry</em>. " 308 "Click this button to copy an <em>entry</em>. "
293 "You can also select the <b>Copy</b> command " 309 "You can also select the <b>Copy</b> command "
294 "from the <b>Edit</b> menu.</p>"; 310 "from the <b>Edit</b> menu.</p>";
295 m_pCopyact->setWhatsThis(kszCopytext); 311 m_pCopyact->setWhatsThis(kszCopytext);
296 312
297 // Paste action 313 // Paste action
298 m_pPasteact = new QAction(trUtf8("Paste"), Pasteiset, trUtf8("&Paste"), CTRL+Key_V, this, "Paste"); 314 m_pPasteact = new Q3Action(trUtf8("Paste"), Pasteiset, trUtf8("&Paste"), Qt::CTRL+Qt::Key_V, this, "Paste");
299 if (m_pPasteact == NULL) // Sanity check 315 if (m_pPasteact == NULL) // Sanity check
300 throw Genexcept("Main window paste edit action creation failed."); 316 throw Genexcept("Main window paste edit action creation failed.");
301 connect(m_pPasteact, SIGNAL(activated()), SLOT(pasteEntry())); 317 connect(m_pPasteact, SIGNAL(activated()), SLOT(pasteEntry()));
302 const char *kszPastetext = "<p><img source=\"paste\"> " 318 const char *kszPastetext = "<p><img source=\"paste\"> "
303 "Click this button to paste an <em>entry</em>. " 319 "Click this button to paste an <em>entry</em>. "
304 "You can also select the <b>Paste</b> command " 320 "You can also select the <b>Paste</b> command "
305 "from the <b>Edit</b> menu.</p>"; 321 "from the <b>Edit</b> menu.</p>";
306 m_pPasteact->setWhatsThis(kszPastetext); 322 m_pPasteact->setWhatsThis(kszPastetext);
307 323
308 // Add data row action 324 // Add data row action
309 m_pAddrowact = new QAction(trUtf8("Add Entry"), Rowaddiset, trUtf8("&Add entry"), Key_Insert, this, "Addentry"); 325 m_pAddrowact = new Q3Action(trUtf8("Add Entry"), Rowaddiset, trUtf8("&Add entry"), Qt::Key_Insert, this, "Addentry");
310 if (m_pAddrowact == NULL) // Sanity check 326 if (m_pAddrowact == NULL) // Sanity check
311 throw Genexcept("Main window add entry action creation failed."); 327 throw Genexcept("Main window add entry action creation failed.");
312 connect(m_pAddrowact, SIGNAL(activated()), SLOT(addEntry())); 328 connect(m_pAddrowact, SIGNAL(activated()), SLOT(addEntry()));
313 const char *kszAddrowtext = "<p><img source=\"rowadd\"> " 329 const char *kszAddrowtext = "<p><img source=\"rowadd\"> "
314 "Click this button to add a <em>new entry</em>. " 330 "Click this button to add a <em>new entry</em>. "
315 "You can also select the <b>Add</b> command " 331 "You can also select the <b>Add</b> command "
316 "from the <b>Edit</b> menu.</p>"; 332 "from the <b>Edit</b> menu.</p>";
317 m_pAddrowact->setWhatsThis(kszAddrowtext); 333 m_pAddrowact->setWhatsThis(kszAddrowtext);
318 334
319 // Delete data row action 335 // Delete data row action
320 m_pDelrowact = new QAction(trUtf8("Delete Entry"), Rowdeliset, trUtf8("&Delete entry"), Key_Delete, this, "Delentry"); 336 m_pDelrowact = new Q3Action(trUtf8("Delete Entry"), Rowdeliset, trUtf8("&Delete entry"), Qt::Key_Delete, this, "Delentry");
321 if (m_pDelrowact == NULL) // Sanity check 337 if (m_pDelrowact == NULL) // Sanity check
322 throw Genexcept("Main window delete entry action creation failed."); 338 throw Genexcept("Main window delete entry action creation failed.");
323 connect(m_pDelrowact, SIGNAL(activated()), SLOT(delEntry())); 339 connect(m_pDelrowact, SIGNAL(activated()), SLOT(delEntry()));
324 const char *kszDelrowtext = "<p><img source=\"rowdel\"> " 340 const char *kszDelrowtext = "<p><img source=\"rowdel\"> "
325 "Click this button to delete a <em>entry</em>. " 341 "Click this button to delete a <em>entry</em>. "
326 "You can also select the <b>Delete</b> command " 342 "You can also select the <b>Delete</b> command "
327 "from the <b>Edit</b> menu.</p>"; 343 "from the <b>Edit</b> menu.</p>";
328 m_pDelrowact->setWhatsThis(kszDelrowtext); 344 m_pDelrowact->setWhatsThis(kszDelrowtext);
329 345
330 // Refresh data display action 346 // Refresh data display action
331 m_pRefreshact = new QAction(trUtf8("Refresh Display"), Refreshiset, trUtf8("&Refresh display"), CTRL+Key_R, this, "Refresh"); 347 m_pRefreshact = new Q3Action(trUtf8("Refresh Display"), Refreshiset, trUtf8("&Refresh display"), Qt::CTRL+Qt::Key_R, this, "Refresh");
332 if (m_pRefreshact == NULL) // Sanity check 348 if (m_pRefreshact == NULL) // Sanity check
333 throw Genexcept("Main window refresh action creation failed."); 349 throw Genexcept("Main window refresh action creation failed.");
334 connect(m_pRefreshact, SIGNAL(activated()), SLOT(refreshDisplay())); 350 connect(m_pRefreshact, SIGNAL(activated()), SLOT(refreshDisplay()));
335 const char *kszRefreshtext = "<p><img source=\"refresh\"> " 351 const char *kszRefreshtext = "<p><img source=\"refresh\"> "
336 "Click this button to <em>refresh the display</em>. " 352 "Click this button to <em>refresh the display</em>. "
337 "You can also select the <b>Refresh</b> command " 353 "You can also select the <b>Refresh</b> command "
338 "from the <b>View</b> menu.</p>"; 354 "from the <b>View</b> menu.</p>";
339 m_pRefreshact->setWhatsThis(kszRefreshtext); 355 m_pRefreshact->setWhatsThis(kszRefreshtext);
340 356
341 // Syncronize data with remote server over IIOP or SOAP action 357 // Syncronize data with remote server over IIOP or SOAP action
342 m_pSyncact = new QAction(trUtf8("Synchronize with server"), Synciset, trUtf8("&Synchronize"), CTRL+Key_E, this, "Synchronize"); 358 m_pSyncact = new Q3Action(trUtf8("Synchronize with server"), Synciset, trUtf8("&Synchronize"), Qt::CTRL+Qt::Key_E, this, "Synchronize");
343 if (m_pSyncact == NULL) // Sanity check 359 if (m_pSyncact == NULL) // Sanity check
344 throw Genexcept("Main window synchronize RPC action creation failed."); 360 throw Genexcept("Main window synchronize RPC action creation failed.");
345 connect(m_pSyncact, SIGNAL(activated()), SLOT(syncIiop())); 361 connect(m_pSyncact, SIGNAL(activated()), SLOT(syncIiop()));
346 connect(m_pSyncact, SIGNAL(activated()), SLOT(syncSoap())); 362 connect(m_pSyncact, SIGNAL(activated()), SLOT(syncSoap()));
347 const char *kszSynctext = "<p><img source=\"syncrpc\"> " 363 const char *kszSynctext = "<p><img source=\"syncrpc\"> "
350 "You can also select the <b>Synchronize</b> command " 366 "You can also select the <b>Synchronize</b> command "
351 "from the <b>Report</b> menu.</p>"; 367 "from the <b>Report</b> menu.</p>";
352 m_pSyncact->setWhatsThis(kszSynctext); 368 m_pSyncact->setWhatsThis(kszSynctext);
353 369
354 // Local report generation action 370 // Local report generation action
355 m_pReportact = new QAction(trUtf8("Generate a local report"), Reportiset, trUtf8("&Report"), CTRL+Key_T, this, "LocalReport"); 371 m_pReportact = new Q3Action(trUtf8("Generate a local report"), Reportiset, trUtf8("&Report"), Qt::CTRL+Qt::Key_T, this, "LocalReport");
356 if (m_pReportact == NULL) // Sanity check 372 if (m_pReportact == NULL) // Sanity check
357 throw Genexcept("Main window local report action creation failed."); 373 throw Genexcept("Main window local report action creation failed.");
358 connect(m_pReportact, SIGNAL(activated()), SLOT(genReport())); 374 connect(m_pReportact, SIGNAL(activated()), SLOT(genReport()));
359 const char *kszReporttext = "<p><img source=\"locreport\"> " 375 const char *kszReporttext = "<p><img source=\"locreport\"> "
360 "Click this button to <em>report your data</em>. " 376 "Click this button to <em>report your data</em>. "
362 "You can also select the <b>Local Report</b> command " 378 "You can also select the <b>Local Report</b> command "
363 "from the <b>Report</b> menu.</p>"; 379 "from the <b>Report</b> menu.</p>";
364 m_pReportact->setWhatsThis(kszReporttext); 380 m_pReportact->setWhatsThis(kszReporttext);
365 381
366 // Offer a formatted preferences panel for intuitive prefs object editing 382 // Offer a formatted preferences panel for intuitive prefs object editing
367 m_pPrefsact = new QAction(trUtf8("Edit the preferences"), QPixmap(s_kpcPrefs_xpm), trUtf8("P&references..."), CTRL+Key_F, this, "Prefspanel"); 383 m_pPrefsact = new Q3Action(trUtf8("Edit the preferences"), QPixmap(s_kpcPrefs_xpm), trUtf8("P&references..."), Qt::CTRL+Qt::Key_F, this, "Prefspanel");
368 if (m_pPrefsact == NULL) // Sanity check 384 if (m_pPrefsact == NULL) // Sanity check
369 throw Genexcept("Main window preferences panel action creation failed."); 385 throw Genexcept("Main window preferences panel action creation failed.");
370 connect(m_pPrefsact, SIGNAL(activated()), SLOT(configPrefs())); 386 connect(m_pPrefsact, SIGNAL(activated()), SLOT(configPrefs()));
371 const char *kszPrefstext = "<p><img source=\"prefs\"> " 387 const char *kszPrefstext = "<p><img source=\"prefs\"> "
372 "Click this button to <em>edit the preferences</em>. " 388 "Click this button to <em>edit the preferences</em>. "
389 405
390 // // Make an easter egg ;-) 406 // // Make an easter egg ;-)
391 // QToolTip::add(m_pMenubar, QRect(0, 0, 2, 2), trUtf8("Easter Egg")); 407 // QToolTip::add(m_pMenubar, QRect(0, 0, 2, 2), trUtf8("Easter Egg"));
392 408
393 // Construct and populate the file menu with actions 409 // Construct and populate the file menu with actions
394 QPopupMenu *pFilepopup = new QPopupMenu(this); 410 Q3PopupMenu *pFilepopup = new Q3PopupMenu(this);
395 if (pFilepopup == NULL) // Sanity check 411 if (pFilepopup == NULL) // Sanity check
396 throw Genexcept("Main window file popup creation failed."); 412 throw Genexcept("Main window file popup creation failed.");
397 m_pMenubar->insertItem(trUtf8("&File"), pFilepopup); 413 m_pMenubar->insertItem(trUtf8("&File"), pFilepopup);
398 m_pFilenewact->addTo(pFilepopup); 414 m_pFilenewact->addTo(pFilepopup);
399 m_pFileopenact->addTo(pFilepopup); 415 m_pFileopenact->addTo(pFilepopup);
404 m_pFilesaveasact->addTo(pFilepopup); 420 m_pFilesaveasact->addTo(pFilepopup);
405 pFilepopup->insertSeparator(); 421 pFilepopup->insertSeparator();
406 m_pFilequitact->addTo(pFilepopup); 422 m_pFilequitact->addTo(pFilepopup);
407 423
408 // Construct and populate the edit menu with subitems 424 // Construct and populate the edit menu with subitems
409 QPopupMenu *pEditpopup = new QPopupMenu(this); 425 Q3PopupMenu *pEditpopup = new Q3PopupMenu(this);
410 if (pEditpopup == NULL) // Sanity check 426 if (pEditpopup == NULL) // Sanity check
411 throw Genexcept("Main window edit popup creation failed."); 427 throw Genexcept("Main window edit popup creation failed.");
412 m_pMenubar->insertItem(trUtf8("&Edit"), pEditpopup); 428 m_pMenubar->insertItem(trUtf8("&Edit"), pEditpopup);
413 m_pCutact->addTo(pEditpopup); 429 m_pCutact->addTo(pEditpopup);
414 m_pCopyact->addTo(pEditpopup); 430 m_pCopyact->addTo(pEditpopup);
418 m_pDelrowact->addTo(pEditpopup); 434 m_pDelrowact->addTo(pEditpopup);
419 pEditpopup->insertSeparator(); 435 pEditpopup->insertSeparator();
420 m_pPrefsact->addTo(pEditpopup); 436 m_pPrefsact->addTo(pEditpopup);
421 437
422 // Construct the view menu and submenus 438 // Construct the view menu and submenus
423 m_pViewpopup = new QPopupMenu(this); 439 m_pViewpopup = new Q3PopupMenu(this);
424 m_pTbarspopup = new QPopupMenu(this); 440 m_pTbarspopup = new Q3PopupMenu(this);
425 m_pColspopup = new QPopupMenu(this); 441 m_pColspopup = new Q3PopupMenu(this);
426 442
427 // Give the new menus krass attributes 443 // Give the new menus krass attributes
428 m_pTbarspopup->insertTearOffHandle(); 444 m_pTbarspopup->insertTearOffHandle();
429 m_pTbarspopup->setCheckable(true); 445 m_pTbarspopup->setCheckable(true);
430 m_pColspopup->insertTearOffHandle(); 446 m_pColspopup->insertTearOffHandle();
480 m_pColspopup->setItemChecked(nMenuid, true); 496 m_pColspopup->setItemChecked(nMenuid, true);
481 nMenuid = m_pColspopup->insertItem(trUtf8("&Remark"), this, SLOT(showRemarkcol())); 497 nMenuid = m_pColspopup->insertItem(trUtf8("&Remark"), this, SLOT(showRemarkcol()));
482 m_pColspopup->setItemChecked(nMenuid, true); 498 m_pColspopup->setItemChecked(nMenuid, true);
483 499
484 // Construct and populate the report menu with subitems 500 // Construct and populate the report menu with subitems
485 QPopupMenu *pReportpopup = new QPopupMenu(this); 501 Q3PopupMenu *pReportpopup = new Q3PopupMenu(this);
486 if (pReportpopup == NULL) // Sanity check 502 if (pReportpopup == NULL) // Sanity check
487 throw Genexcept("Main window report popup creation failed."); 503 throw Genexcept("Main window report popup creation failed.");
488 m_pMenubar->insertItem(trUtf8("&Report"), pReportpopup); 504 m_pMenubar->insertItem(trUtf8("&Report"), pReportpopup);
489 #if defined HAVE_MICO || defined HAVE_ESOAP 505 #if defined HAVE_MICO || defined HAVE_ESOAP
490 m_pSyncact->addTo(pReportpopup); 506 m_pSyncact->addTo(pReportpopup);
495 511
496 // Pad spacing to force help menu to appear far right 512 // Pad spacing to force help menu to appear far right
497 m_pMenubar->insertSeparator(); 513 m_pMenubar->insertSeparator();
498 514
499 // Construct and populate the help menu with subitems 515 // Construct and populate the help menu with subitems
500 QPopupMenu *pHelppopup = new QPopupMenu(this); 516 Q3PopupMenu *pHelppopup = new Q3PopupMenu(this);
501 if (pHelppopup == NULL) // Sanity check 517 if (pHelppopup == NULL) // Sanity check
502 throw Genexcept("Main window help popup creation failed."); 518 throw Genexcept("Main window help popup creation failed.");
503 m_pMenubar->insertItem(trUtf8("&Help"), pHelppopup); 519 m_pMenubar->insertItem(trUtf8("&Help"), pHelppopup);
504 pHelppopup->insertItem(trUtf8("&Contents"), this, SLOT(helpContents()), Key_F1); 520 pHelppopup->insertItem(trUtf8("&Contents"), this, SLOT(helpContents()), Qt::Key_F1);
505 pHelppopup->insertSeparator(); 521 pHelppopup->insertSeparator();
506 pHelppopup->insertItem(trUtf8("About &as-gui"), this, SLOT(aboutTitraq())); 522 pHelppopup->insertItem(trUtf8("About &as-gui"), this, SLOT(aboutTitraq()));
507 pHelppopup->insertItem(trUtf8("About &OSSP"), this, SLOT(aboutOSSP())); 523 pHelppopup->insertItem(trUtf8("About &OSSP"), this, SLOT(aboutOSSP()));
508 pHelppopup->insertItem(trUtf8("About &Qt"), this, SLOT(aboutQt())); 524 pHelppopup->insertItem(trUtf8("About &Qt"), this, SLOT(aboutQt()));
509 pHelppopup->insertSeparator(); 525 pHelppopup->insertSeparator();
510 pHelppopup->insertItem(QPixmap(s_kpcWhatsthis_xpm), trUtf8("What's &This"), this, SLOT(whatsThis()), SHIFT+Key_F1); 526 pHelppopup->insertItem(QPixmap(s_kpcWhatsthis_xpm), trUtf8("What's &This"), this, SLOT(whatsThis()), Qt::SHIFT+Qt::Key_F1);
511 } 527 }
512 528
513 // 529 //
514 // Construct the tool bars 530 // Construct the tool bars
515 // 531 //
516 void Titraqform::setupToolbars(void) 532 void Titraqform::setupToolbars(void)
517 { 533 {
518 // Construct and populate the file tool bar 534 // Construct and populate the file tool bar
519 m_pFiletools = new QToolBar("Toolfile", this, DockTop); 535 m_pFiletools = new Q3ToolBar("Toolfile", this, Qt::DockTop);
520 if (m_pFiletools == NULL) // Sanity check 536 if (m_pFiletools == NULL) // Sanity check
521 throw Genexcept("File tool bar creation failed."); 537 throw Genexcept("File tool bar creation failed.");
522 m_pFiletools->setLabel(trUtf8("File Ops")); 538 m_pFiletools->setLabel(trUtf8("File Ops"));
523 m_pFiletools->setOpaqueMoving(false); 539 m_pFiletools->setOpaqueMoving(false);
524 m_pFiletools->setCloseMode(QDockWindow::Never); 540 m_pFiletools->setCloseMode(Q3DockWindow::Never);
525 m_pFilenewact->addTo(m_pFiletools); 541 m_pFilenewact->addTo(m_pFiletools);
526 m_pFileopenact->addTo(m_pFiletools); 542 m_pFileopenact->addTo(m_pFiletools);
527 m_pFilesaveact->addTo(m_pFiletools); 543 m_pFilesaveact->addTo(m_pFiletools);
528 544
529 // Construct and populate the edit tool bar 545 // Construct and populate the edit tool bar
530 m_pEdittools = new QToolBar("Tooledit", this, DockTop); 546 m_pEdittools = new Q3ToolBar("Tooledit", this, Qt::DockTop);
531 if (m_pEdittools == NULL) // Sanity check 547 if (m_pEdittools == NULL) // Sanity check
532 throw Genexcept("Edit tool bar creation failed."); 548 throw Genexcept("Edit tool bar creation failed.");
533 m_pEdittools->setLabel(trUtf8("Edit Ops")); 549 m_pEdittools->setLabel(trUtf8("Edit Ops"));
534 m_pEdittools->setOpaqueMoving(false); 550 m_pEdittools->setOpaqueMoving(false);
535 m_pEdittools->setCloseMode(QDockWindow::Never); 551 m_pEdittools->setCloseMode(Q3DockWindow::Never);
536 m_pCutact->addTo(m_pEdittools); 552 m_pCutact->addTo(m_pEdittools);
537 m_pCopyact->addTo(m_pEdittools); 553 m_pCopyact->addTo(m_pEdittools);
538 m_pPasteact->addTo(m_pEdittools); 554 m_pPasteact->addTo(m_pEdittools);
539 m_pEdittools->addSeparator(); 555 m_pEdittools->addSeparator();
540 m_pAddrowact->addTo(m_pEdittools); 556 m_pAddrowact->addTo(m_pEdittools);
541 m_pDelrowact->addTo(m_pEdittools); 557 m_pDelrowact->addTo(m_pEdittools);
542 558
543 // Construct and populate the view tool bar 559 // Construct and populate the view tool bar
544 m_pViewtools = new QToolBar("Toolview", this, DockTop); 560 m_pViewtools = new Q3ToolBar("Toolview", this, Qt::DockTop);
545 if (m_pViewtools == NULL) // Sanity check 561 if (m_pViewtools == NULL) // Sanity check
546 throw Genexcept("View tool bar creation failed."); 562 throw Genexcept("View tool bar creation failed.");
547 m_pViewtools->setLabel(trUtf8("View Ops")); 563 m_pViewtools->setLabel(trUtf8("View Ops"));
548 m_pViewtools->setOpaqueMoving(false); 564 m_pViewtools->setOpaqueMoving(false);
549 m_pViewtools->setCloseMode(QDockWindow::Never); 565 m_pViewtools->setCloseMode(Q3DockWindow::Never);
550 m_pRefreshact->addTo(m_pViewtools); 566 m_pRefreshact->addTo(m_pViewtools);
551 m_pReportact->addTo(m_pViewtools); 567 m_pReportact->addTo(m_pViewtools);
552 m_pSyncact->addTo(m_pViewtools); 568 m_pSyncact->addTo(m_pViewtools);
553 569
554 // Construct and populate the lonely preferences tool bar 570 // Construct and populate the lonely preferences tool bar
555 m_pPrefstools = new QToolBar("Preferences", this, DockTop); 571 m_pPrefstools = new Q3ToolBar("Preferences", this, Qt::DockTop);
556 if (m_pPrefstools == NULL) // Sanity check 572 if (m_pPrefstools == NULL) // Sanity check
557 throw Genexcept("Prefs tool bar creation failed."); 573 throw Genexcept("Prefs tool bar creation failed.");
558 m_pPrefstools->setLabel(trUtf8("Preferences editor")); 574 m_pPrefstools->setLabel(trUtf8("Preferences editor"));
559 m_pPrefstools->setOpaqueMoving(false); 575 m_pPrefstools->setOpaqueMoving(false);
560 m_pPrefstools->setCloseMode(QDockWindow::Never); 576 m_pPrefstools->setCloseMode(Q3DockWindow::Never);
561 m_pPrefsact->addTo(m_pPrefstools); 577 m_pPrefsact->addTo(m_pPrefstools);
562 578
563 // Construct and populate the lonely whatsthis tool bar 579 // Construct and populate the lonely whatsthis tool bar
564 m_pWhatstools = new QToolBar("Toolwhats", this, DockTop); 580 m_pWhatstools = new Q3ToolBar("Toolwhats", this, Qt::DockTop);
565 if (m_pWhatstools == NULL) // Sanity check 581 if (m_pWhatstools == NULL) // Sanity check
566 throw Genexcept("Whats this tool bar creation failed."); 582 throw Genexcept("Whats this tool bar creation failed.");
567 m_pWhatstools->setLabel(trUtf8("Whats this")); 583 m_pWhatstools->setLabel(trUtf8("Whats this"));
568 m_pWhatstools->setOpaqueMoving(false); 584 m_pWhatstools->setOpaqueMoving(false);
569 m_pWhatstools->setCloseMode(QDockWindow::Never); 585 m_pWhatstools->setCloseMode(Q3DockWindow::Never);
570 QWhatsThis::whatsThisButton(m_pWhatstools); // Preconfigured whats this button 586 Q3WhatsThis::whatsThisButton(m_pWhatstools); // Preconfigured whats this button
571 } 587 }
572 588
573 // 589 //
574 // Construct the central frame 590 // Construct the central frame
575 // 591 //
576 void Titraqform::setupCentralwidget(void) 592 void Titraqform::setupCentralwidget(void)
577 { 593 {
578 // Create a central frame and associated layout for QMainWindow 594 // Create a central frame and associated layout for QMainWindow
579 m_pCenframe = new QFrame(this, "Centralframe"); 595 m_pCenframe = new Q3Frame(this, "Centralframe");
580 if (m_pCenframe == NULL) // Sanity check 596 if (m_pCenframe == NULL) // Sanity check
581 throw Genexcept("Main window central frame creation failed."); 597 throw Genexcept("Main window central frame creation failed.");
582 m_pCenframe->setFrameShape(QFrame::StyledPanel); 598 m_pCenframe->setFrameShape(Q3Frame::StyledPanel);
583 m_pCenframe->setFrameShadow(QFrame::Sunken); 599 m_pCenframe->setFrameShadow(Q3Frame::Sunken);
584 this->setCentralWidget(m_pCenframe); 600 this->setCentralWidget(m_pCenframe);
585 601
586 // Layout controls for table, editing widgets 602 // Layout controls for table, editing widgets
587 m_pMainlayout = new QVBoxLayout(m_pCenframe, TITRAQ_MARGIN, TITRAQ_SPACING, "Mainlayout"); // For layouts 603 m_pMainlayout = new Q3VBoxLayout(m_pCenframe, TITRAQ_MARGIN, TITRAQ_SPACING, "Mainlayout"); // For layouts
588 m_pPackagelayout = new QVBoxLayout(0, 0, TITRAQ_SPACING, "Packagelayout"); // For table 604 m_pPackagelayout = new Q3VBoxLayout(0, 0, TITRAQ_SPACING, "Packagelayout"); // For table
589 m_pEditlayout = new QHBoxLayout(0, 0, TITRAQ_SPACING, "Editlayout"); // For edits 605 m_pEditlayout = new Q3HBoxLayout(0, 0, TITRAQ_SPACING, "Editlayout"); // For edits
590 606
591 // Major sanity check wrapped in one call 607 // Major sanity check wrapped in one call
592 if (!(m_pMainlayout && m_pPackagelayout && m_pEditlayout)) 608 if (!(m_pMainlayout && m_pPackagelayout && m_pEditlayout))
593 throw Genexcept("Main window layout creation failed."); 609 throw Genexcept("Main window layout creation failed.");
594 610
618 throw Genexcept("Main window table creation failed."); 634 throw Genexcept("Main window table creation failed.");
619 m_pMaintable->setNumCols(TITRAQ_IDXTAIL); 635 m_pMaintable->setNumCols(TITRAQ_IDXTAIL);
620 m_pMaintable->setDirty(false); // Reset data to clean state 636 m_pMaintable->setDirty(false); // Reset data to clean state
621 m_pMaintable->setReadOnly(true); // Table is read only 637 m_pMaintable->setReadOnly(true); // Table is read only
622 m_pMaintable->setColumnMovingEnabled(false); // Ctrl-drag disabled 638 m_pMaintable->setColumnMovingEnabled(false); // Ctrl-drag disabled
623 m_pMaintable->setSelectionMode(QTable::MultiRow); // Multi row selection 639 m_pMaintable->setSelectionMode(Q3Table::MultiRow); // Multi row selection
624 m_pMaintable->setFocusStyle(QTable::FollowStyle); // How cells are drawn 640 m_pMaintable->setFocusStyle(Q3Table::FollowStyle); // How cells are drawn
625 m_pMaintable->setLeftMargin(0); // Get rid of the vertical header 641 m_pMaintable->setLeftMargin(0); // Get rid of the vertical header
626 m_pMaintable->verticalHeader()->hide(); // by hiding it with a margin of 0 642 m_pMaintable->verticalHeader()->hide(); // by hiding it with a margin of 0
627 m_pMaintable->horizontalHeader()->setResizeEnabled(true); 643 m_pMaintable->horizontalHeader()->setResizeEnabled(true);
628 m_pMaintable->horizontalHeader()->setClickEnabled(true); // Allow click signals 644 m_pMaintable->horizontalHeader()->setClickEnabled(true); // Allow click signals
629 m_pMaintable->horizontalHeader()->setTracking(false); // No continuous tracking 645 m_pMaintable->horizontalHeader()->setTracking(false); // No continuous tracking
634 m_pMaintable->setSortdir(m_pPrefs->getBool(TITRAQ_PREFSORTDIR, TITRAQ_DEFSORTDIR)); 650 m_pMaintable->setSortdir(m_pPrefs->getBool(TITRAQ_PREFSORTDIR, TITRAQ_DEFSORTDIR));
635 m_pMaintable->setSorting(true); 651 m_pMaintable->setSorting(true);
636 652
637 // Table header row 653 // Table header row
638 m_pTablehead = m_pMaintable->horizontalHeader(); 654 m_pTablehead = m_pMaintable->horizontalHeader();
639 m_pMaintable->setHScrollBarMode(QScrollView::AlwaysOff); 655 m_pMaintable->setHScrollBarMode(Q3ScrollView::AlwaysOff);
640 m_pTablehead->setLabel(TITRAQ_IDXSTATUS, QObject::trUtf8("Stat"), 656 m_pTablehead->setLabel(TITRAQ_IDXSTATUS, QObject::trUtf8("Stat"),
641 m_pPrefs->getNumber(TITRAQ_PREFSTATCOLWIDTH, TITRAQ_DEFSTATCOLWIDTH)); 657 m_pPrefs->getNumber(TITRAQ_PREFSTATCOLWIDTH, TITRAQ_DEFSTATCOLWIDTH));
642 m_pMaintable->setColumnReadOnly (TITRAQ_IDXSTATUS, true); 658 m_pMaintable->setColumnReadOnly (TITRAQ_IDXSTATUS, true);
643 m_pTablehead->setLabel(TITRAQ_IDXLINE, QObject::trUtf8("Line"), 659 m_pTablehead->setLabel(TITRAQ_IDXLINE, QObject::trUtf8("Line"),
644 m_pPrefs->getNumber(TITRAQ_PREFLCOLWIDTH, TITRAQ_DEFLCOLWIDTH)); 660 m_pPrefs->getNumber(TITRAQ_PREFLCOLWIDTH, TITRAQ_DEFLCOLWIDTH));
694 710
695 // Whatsthis info for the item status edit 711 // Whatsthis info for the item status edit
696 const char *kszStatustext = "The <em>item status</em> shows a green " 712 const char *kszStatustext = "The <em>item status</em> shows a green "
697 "symbol for valid entries, a yellow symbol " 713 "symbol for valid entries, a yellow symbol "
698 "for warning, and a red symbol for flawed entries."; 714 "for warning, and a red symbol for flawed entries.";
699 QWhatsThis::add(m_pStatusedit, kszStatustext); 715 Q3WhatsThis::add(m_pStatusedit, kszStatustext);
700 QToolTip::add(m_pStatusedit, trUtf8("Status Indicator")); 716 QToolTip::add(m_pStatusedit, trUtf8("Status Indicator"));
701 m_pEditlayout->addWidget(m_pStatusedit); // Finally add the item status edit 717 m_pEditlayout->addWidget(m_pStatusedit); // Finally add the item status edit
702 718
703 // Make the line number edit 719 // Make the line number edit
704 m_pLineedit = new QLineEdit(m_pCenframe, "Lineno"); 720 m_pLineedit = new QLineEdit(m_pCenframe, "Lineno");
713 729
714 // Whatsthis info for the line number edit 730 // Whatsthis info for the line number edit
715 const char *kszLinenotext = "The <em>line number</em> helps identify " 731 const char *kszLinenotext = "The <em>line number</em> helps identify "
716 "an entry when a warning or error message " 732 "an entry when a warning or error message "
717 "appears."; 733 "appears.";
718 QWhatsThis::add(m_pLineedit, kszLinenotext); 734 Q3WhatsThis::add(m_pLineedit, kszLinenotext);
719 QToolTip::add(m_pLineedit, trUtf8("Line Number")); 735 QToolTip::add(m_pLineedit, trUtf8("Line Number"));
720 m_pEditlayout->addWidget(m_pLineedit); // Finally add the line number edit 736 m_pEditlayout->addWidget(m_pLineedit); // Finally add the line number edit
721 737
722 // Make the user edit 738 // Make the user edit
723 m_pUseredit = new QLineEdit(m_pCenframe, "User"); 739 m_pUseredit = new QLineEdit(m_pCenframe, "User");
731 747
732 // Whatsthis info for the user edit 748 // Whatsthis info for the user edit
733 const char *kszUsertext = "Edit the <em>user name</em> by clicking " 749 const char *kszUsertext = "Edit the <em>user name</em> by clicking "
734 "on this control and typing the user name " 750 "on this control and typing the user name "
735 "you want to account."; 751 "you want to account.";
736 QWhatsThis::add(m_pUseredit, kszUsertext); 752 Q3WhatsThis::add(m_pUseredit, kszUsertext);
737 QToolTip::add(m_pUseredit, trUtf8("User Name")); 753 QToolTip::add(m_pUseredit, trUtf8("User Name"));
738 m_pEditlayout->addWidget(m_pUseredit); // Finally add the user edit 754 m_pEditlayout->addWidget(m_pUseredit); // Finally add the user edit
739 755
740 // Make the GUID edit 756 // Make the GUID edit
741 m_pGuidedit = new QLineEdit(m_pCenframe, "Guid"); 757 m_pGuidedit = new QLineEdit(m_pCenframe, "Guid");
749 765
750 // Whatsthis info for the GUID edit 766 // Whatsthis info for the GUID edit
751 const char *kszGuidtext = "Edit the <em>GUID</em> by clicking " 767 const char *kszGuidtext = "Edit the <em>GUID</em> by clicking "
752 "on this control and typing the GUID " 768 "on this control and typing the GUID "
753 "corresponding to this account item."; 769 "corresponding to this account item.";
754 QWhatsThis::add(m_pGuidedit, kszGuidtext); 770 Q3WhatsThis::add(m_pGuidedit, kszGuidtext);
755 QToolTip::add(m_pGuidedit, trUtf8("GUID")); 771 QToolTip::add(m_pGuidedit, trUtf8("GUID"));
756 m_pEditlayout->addWidget(m_pGuidedit); // Finally add the GUID edit 772 m_pEditlayout->addWidget(m_pGuidedit); // Finally add the GUID edit
757 773
758 // Make the CRC edit 774 // Make the CRC edit
759 m_pCrcedit = new QLineEdit(m_pCenframe, "Crc"); 775 m_pCrcedit = new QLineEdit(m_pCenframe, "Crc");
767 783
768 // Whatsthis info for the CRC edit 784 // Whatsthis info for the CRC edit
769 const char *kszCrctext = "Edit the <em>CRC</em> by clicking " 785 const char *kszCrctext = "Edit the <em>CRC</em> by clicking "
770 "on this control and typing the new " 786 "on this control and typing the new "
771 "value for this account item."; 787 "value for this account item.";
772 QWhatsThis::add(m_pCrcedit, kszCrctext); 788 Q3WhatsThis::add(m_pCrcedit, kszCrctext);
773 QToolTip::add(m_pCrcedit, trUtf8("CRC")); 789 QToolTip::add(m_pCrcedit, trUtf8("CRC"));
774 m_pEditlayout->addWidget(m_pCrcedit); // Finally add the CRC edit 790 m_pEditlayout->addWidget(m_pCrcedit); // Finally add the CRC edit
775 791
776 // Make the revision edit 792 // Make the revision edit
777 m_pRevedit = new QLineEdit(m_pCenframe, "Revision"); 793 m_pRevedit = new QLineEdit(m_pCenframe, "Revision");
785 801
786 // Whatsthis info for the revision edit 802 // Whatsthis info for the revision edit
787 const char *kszRevtext = "Edit the <em>revision</em> by clicking " 803 const char *kszRevtext = "Edit the <em>revision</em> by clicking "
788 "on this control and typing the new value " 804 "on this control and typing the new value "
789 "for this account type."; 805 "for this account type.";
790 QWhatsThis::add(m_pRevedit, kszRevtext); 806 Q3WhatsThis::add(m_pRevedit, kszRevtext);
791 QToolTip::add(m_pRevedit, trUtf8("Revision")); 807 QToolTip::add(m_pRevedit, trUtf8("Revision"));
792 m_pEditlayout->addWidget(m_pRevedit); // Finally add the revision edit 808 m_pEditlayout->addWidget(m_pRevedit); // Finally add the revision edit
793 809
794 // Make the date selector 810 // Make the date selector
795 m_pDateedit = new Daydatedit(QDate::currentDate(), m_pCenframe, "Date"); 811 m_pDateedit = new Daydatedit(QDate::currentDate(), m_pCenframe, "Date");
796 if (m_pDateedit == NULL) // Sanity check 812 if (m_pDateedit == NULL) // Sanity check
797 throw Genexcept("Main window date edit creation failed."); // Spew errors 813 throw Genexcept("Main window date edit creation failed."); // Spew errors
798 814
799 // Configure attributes 815 // Configure attributes
800 m_pDateedit->setOrder(QDateEdit::YMD); 816 m_pDateedit->setOrder(Q3DateEdit::YMD);
801 m_pDateedit->setAutoAdvance(true); 817 m_pDateedit->setAutoAdvance(true);
802 m_pDateedit->setSeparator(trUtf8("-")); 818 m_pDateedit->setSeparator(trUtf8("-"));
803 m_pDateedit->setEnabled(false); 819 m_pDateedit->setEnabled(false);
804 820
805 // Whatsthis info for the date editor 821 // Whatsthis info for the date editor
806 const char *kszDateedit = "Edit the <em>task date</em> by clicking on " 822 const char *kszDateedit = "Edit the <em>task date</em> by clicking on "
807 "the year, month, or day, and then changing their " 823 "the year, month, or day, and then changing their "
808 "values with the arrow buttons."; 824 "values with the arrow buttons.";
809 QWhatsThis::add(m_pDateedit, kszDateedit); 825 Q3WhatsThis::add(m_pDateedit, kszDateedit);
810 QToolTip::add(m_pDateedit, trUtf8("Task Date")); 826 QToolTip::add(m_pDateedit, trUtf8("Task Date"));
811 m_pEditlayout->addWidget(m_pDateedit); // Finally add the date editor 827 m_pEditlayout->addWidget(m_pDateedit); // Finally add the date editor
812 828
813 // Make the start time selector 829 // Make the start time selector
814 m_pStarttime = new QTimeEdit(m_pCenframe, "StartTime"); 830 m_pStarttime = new Q3TimeEdit(m_pCenframe, "StartTime");
815 if (m_pStarttime == NULL) // Sanity check 831 if (m_pStarttime == NULL) // Sanity check
816 throw Genexcept("Main window start time creation failed."); // Spew errors 832 throw Genexcept("Main window start time creation failed."); // Spew errors
817 833
818 // Configure attributes 834 // Configure attributes
819 m_pStarttime->setDisplay(QTimeEdit::Hours | QTimeEdit::Minutes); 835 m_pStarttime->setDisplay(Q3TimeEdit::Hours | Q3TimeEdit::Minutes);
820 m_pStarttime->setAutoAdvance(true); 836 m_pStarttime->setAutoAdvance(true);
821 m_pStarttime->setEnabled(false); 837 m_pStarttime->setEnabled(false);
822 838
823 // Whatsthis info for the time editor 839 // Whatsthis info for the time editor
824 const char *kszStarttime = "Edit the <em>task starting time</em> by clicking on " 840 const char *kszStarttime = "Edit the <em>task starting time</em> by clicking on "
825 "the hour and minute, and then changing their " 841 "the hour and minute, and then changing their "
826 "values with the arrow buttons."; 842 "values with the arrow buttons.";
827 QWhatsThis::add(m_pStarttime, kszStarttime); 843 Q3WhatsThis::add(m_pStarttime, kszStarttime);
828 QToolTip::add(m_pStarttime, trUtf8("Task Starting Time")); 844 QToolTip::add(m_pStarttime, trUtf8("Task Starting Time"));
829 m_pEditlayout->addWidget(m_pStarttime); // Finally add the start editor 845 m_pEditlayout->addWidget(m_pStarttime); // Finally add the start editor
830 846
831 // Make the end time selector 847 // Make the end time selector
832 m_pEndtime = new QTimeEdit(m_pCenframe, "EndTime"); 848 m_pEndtime = new Q3TimeEdit(m_pCenframe, "EndTime");
833 if (m_pEndtime == NULL) // Sanity check 849 if (m_pEndtime == NULL) // Sanity check
834 throw Genexcept("Main window end time creation failed."); // Spew errors 850 throw Genexcept("Main window end time creation failed."); // Spew errors
835 851
836 // Configure attributes 852 // Configure attributes
837 m_pEndtime->setDisplay(QTimeEdit::Hours | QTimeEdit::Minutes); 853 m_pEndtime->setDisplay(Q3TimeEdit::Hours | Q3TimeEdit::Minutes);
838 m_pEndtime->setAutoAdvance(true); 854 m_pEndtime->setAutoAdvance(true);
839 m_pEndtime->setEnabled(false); 855 m_pEndtime->setEnabled(false);
840 856
841 // Whatsthis info for the time editor 857 // Whatsthis info for the time editor
842 const char *kszEndtime = "Edit the <em>task ending time</em> by clicking on " 858 const char *kszEndtime = "Edit the <em>task ending time</em> by clicking on "
843 "the hour and minute, and then changing their " 859 "the hour and minute, and then changing their "
844 "values with the arrow buttons."; 860 "values with the arrow buttons.";
845 QWhatsThis::add(m_pEndtime, kszEndtime); 861 Q3WhatsThis::add(m_pEndtime, kszEndtime);
846 QToolTip::add(m_pEndtime, trUtf8("Task Ending Time")); 862 QToolTip::add(m_pEndtime, trUtf8("Task Ending Time"));
847 m_pEditlayout->addWidget(m_pEndtime); // Finally add the end editor 863 m_pEditlayout->addWidget(m_pEndtime); // Finally add the end editor
848 864
849 // // Make the total time amount selector 865 // // Make the total time amount selector
850 // m_pAmount = new QTimeEdit(m_pCenframe, "TotalAmount"); 866 // m_pAmount = new QTimeEdit(m_pCenframe, "TotalAmount");
863 879
864 // Whatsthis info for the amount editor 880 // Whatsthis info for the amount editor
865 const char *kszAmount = "Edit the <em>task amount</em> by clicking on " 881 const char *kszAmount = "Edit the <em>task amount</em> by clicking on "
866 "the amount, and then changing its " 882 "the amount, and then changing its "
867 "value with the arrow buttons."; 883 "value with the arrow buttons.";
868 QWhatsThis::add(m_pAmount, kszAmount); 884 Q3WhatsThis::add(m_pAmount, kszAmount);
869 QToolTip::add(m_pAmount, trUtf8("Task Amount")); 885 QToolTip::add(m_pAmount, trUtf8("Task Amount"));
870 m_pAmount->setEnabled(false); // Don't enable until it's ready 886 m_pAmount->setEnabled(false); // Don't enable until it's ready
871 m_pEditlayout->addWidget(m_pAmount); // Finally add the amount editor 887 m_pEditlayout->addWidget(m_pAmount); // Finally add the amount editor
872 888
873 // Construct a stringlist just to hold task values 889 // Construct a stringlist just to hold task values
881 Asdir = QDir::homeDirPath() + Asdir.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1); 897 Asdir = QDir::homeDirPath() + Asdir.remove(0, QString(TITRAQ_HOMEDIRTOK).length() - 1);
882 QFile Filetemp(Asdir); 898 QFile Filetemp(Asdir);
883 this->loadAccounts(Filetemp); // Load account helper method 899 this->loadAccounts(Filetemp); // Load account helper method
884 900
885 // Make the combobox task edit 901 // Make the combobox task edit
886 m_pTasks = new QComboBox(true, m_pCenframe, "Tasks"); 902 m_pTasks = new Q3ComboBox(true, m_pCenframe, "Tasks");
887 if (m_pTasks == NULL) // Sanity check 903 if (m_pTasks == NULL) // Sanity check
888 throw Genexcept("Main window task edit creation failed."); 904 throw Genexcept("Main window task edit creation failed.");
889 m_pTasks->insertStringList(*m_pTaskentries); 905 m_pTasks->insertStringList(*m_pTaskentries);
890 m_pTasks->setCurrentText(NULL); 906 m_pTasks->setCurrentText(NULL);
891 m_pTasks->setSizeLimit(TITRAQ_ACCTBOXHEIGHT); 907 m_pTasks->setSizeLimit(TITRAQ_ACCTBOXHEIGHT);
897 // Add an auto scroll bar if possible under current GUI style 913 // Add an auto scroll bar if possible under current GUI style
898 if (m_pTasks->listBox()) { // Motif style has no list box 914 if (m_pTasks->listBox()) { // Motif style has no list box
899 int nPopupwidth = m_pTasks->listBox()->maxItemWidth(); 915 int nPopupwidth = m_pTasks->listBox()->maxItemWidth();
900 nPopupwidth += m_pTasks->listBox()->horizontalScrollBar()->height(); 916 nPopupwidth += m_pTasks->listBox()->horizontalScrollBar()->height();
901 m_pTasks->listBox()->setFixedWidth(nPopupwidth); 917 m_pTasks->listBox()->setFixedWidth(nPopupwidth);
902 m_pTasks->listBox()->setHScrollBarMode(QScrollView::Auto); 918 m_pTasks->listBox()->setHScrollBarMode(Q3ScrollView::Auto);
903 m_pTasks->listBox()->sort(); 919 m_pTasks->listBox()->sort();
904 } 920 }
905 921
906 // Whatsthis info for the task editor 922 // Whatsthis info for the task editor
907 const char *kszTasktext = "Choose a <em>task account</em> by clicking on " 923 const char *kszTasktext = "Choose a <em>task account</em> by clicking on "
908 "this box, and choosing whichever item most " 924 "this box, and choosing whichever item most "
909 "closely resembles your task."; 925 "closely resembles your task.";
910 QWhatsThis::add(m_pTasks, kszTasktext); 926 Q3WhatsThis::add(m_pTasks, kszTasktext);
911 QToolTip::add(m_pTasks, trUtf8("Task Selector")); 927 QToolTip::add(m_pTasks, trUtf8("Task Selector"));
912 m_pEditlayout->addWidget(m_pTasks); // Finally add the task edit 928 m_pEditlayout->addWidget(m_pTasks); // Finally add the task edit
913 929
914 // Make the Remark line 930 // Make the Remark line
915 m_pRemark = new QLineEdit(m_pCenframe, "Remark"); 931 m_pRemark = new QLineEdit(m_pCenframe, "Remark");
923 939
924 // Whatsthis info for the remark line 940 // Whatsthis info for the remark line
925 const char *kszRemarktext = "Edit the <em>task remarks</em> by clicking on " 941 const char *kszRemarktext = "Edit the <em>task remarks</em> by clicking on "
926 "this line control and typing the remarks you " 942 "this line control and typing the remarks you "
927 "have about the task."; 943 "have about the task.";
928 QWhatsThis::add(m_pRemark, kszRemarktext); 944 Q3WhatsThis::add(m_pRemark, kszRemarktext);
929 QToolTip::add(m_pRemark, trUtf8("Remark Line")); 945 QToolTip::add(m_pRemark, trUtf8("Remark Line"));
930 m_pEditlayout->addWidget(m_pRemark); // Finally add the remark line 946 m_pEditlayout->addWidget(m_pRemark); // Finally add the remark line
931 947
932 // Start edit controls off at right size 948 // Start edit controls off at right size
933 this->updSizes(TITRAQ_IDXALLCTRLS, -1, -1); 949 this->updSizes(TITRAQ_IDXALLCTRLS, -1, -1);

mercurial