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 " |
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\"> " |
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 |
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"); |