]> Shamusworld >> Repos - architektonas/blob - src/forms/exitdialog.cpp
Fixed problem with MDI activation.
[architektonas] / src / forms / exitdialog.cpp
1 // exitdialog.cpp
2 //
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
9 //
10 // JLH = James L. Hammons <jlhamm@acm.org>
11 //
12 // Who  When        What
13 // ---  ----------  -----------------------------------------------------------
14 // JLH  05/12/2010  Created this file. :-)
15 //
16
17 #include "exitdialog.h"
18
19 #include <QMessageBox>
20
21 ExitDialog::ExitDialog(QWidget * parent/*= NULL*/, Qt::WindowFlags flags/*= 0*/):
22         QDialog(parent, flags)
23 {
24         ui.setupUi(this);
25
26 #if 0
27         //set dlg icon
28         QMessageBox mb("", "", QMessageBox::Warning, QMessageBox::Ok, Qt::NoButton, Qt::NoButton);
29         l_icon->setPixmap(*mb.iconPixmap());
30 #else
31 #warning "Needs porting to Qt4... !!! FIX !!!"
32 #endif
33 // Icons are now put on the form
34 //      bLeave->setIconSet(qPixmapFromMimeSource("fileclose.png"));
35 //      ui.bLeave->setIcon(QIcon(":/images/fileclose.png"));
36         makeLetterAccel(ui.bLeave);
37 //      bSave->setIconSet(qPixmapFromMimeSource("filesave2.png"));
38 //      ui.bSave->setIcon(QIcon(":/images/filesave2.png"));
39         makeLetterAccel(ui.bSave);
40 //      bSaveAs->setIconSet(qPixmapFromMimeSource("filesaveas.png"));
41 //      ui.bSaveAs->setIcon(QIcon(":/images/filesaveas.png"));
42         makeLetterAccel(ui.bSaveAs);
43         makeLetterAccel(ui.bCancel);
44 }
45
46 ExitDialog::~ExitDialog()
47 {
48 }
49
50 void ExitDialog::setText(const QString & text)
51 {
52         ui.lQuestion->setText(text);
53 #if 0
54         resize(lQuestion->sizeHint().width() + 32,
55                 lQuestion->sizeHint().height() + layButtons->sizeHint().height() + 32);
56 #else
57 #warning "Needs porting to Qt4... !!! FIX !!!"
58 #endif
59 }
60
61 void ExitDialog::setTitle(const QString & text)
62 {
63         setWindowTitle(text);
64 }
65
66 void ExitDialog::slotSaveAs()
67 {
68         done(3);
69 }
70
71 void ExitDialog::slotSave()
72 {
73         done(2);
74 }
75
76 //sets additional accel, eg. Key_A for ALT+Key_A
77 void ExitDialog::makeLetterAccel(QPushButton * btn)
78 {
79 #if 0
80         if (btn->accel().count() < 1)
81                 return;
82
83         Q3Accel * a = new Q3Accel(btn);
84         a->connectItem(a->insertItem(btn->accel() & ~(Qt::MODIFIER_MASK | Qt::UNICODE_ACCEL)),
85                 btn, SLOT(animateClick()));
86 #else
87 #warning "Needs porting to Qt4... !!! FIX !!!"
88 #endif
89 }