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
10 // JLH = James L. Hammons <jlhamm@acm.org>
13 // --- ---------- -----------------------------------------------------------
14 // JLH 05/12/2010 Created this file. :-)
17 #include "exitdialog.h"
19 #include <QMessageBox>
21 ExitDialog::ExitDialog(QWidget * parent/*= NULL*/, Qt::WindowFlags flags/*= 0*/):
22 QDialog(parent, flags)
28 QMessageBox mb("", "", QMessageBox::Warning, QMessageBox::Ok, Qt::NoButton, Qt::NoButton);
29 l_icon->setPixmap(*mb.iconPixmap());
31 #warning "Needs porting to Qt4... !!! FIX !!!"
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);
46 ExitDialog::~ExitDialog()
50 void ExitDialog::setText(const QString & text)
52 ui.lQuestion->setText(text);
54 resize(lQuestion->sizeHint().width() + 32,
55 lQuestion->sizeHint().height() + layButtons->sizeHint().height() + 32);
57 #warning "Needs porting to Qt4... !!! FIX !!!"
61 void ExitDialog::setTitle(const QString & text)
66 void ExitDialog::setForce(bool force)
68 ui.bCancel->setDisabled(force);
71 void ExitDialog::slotSaveAs()
76 void ExitDialog::slotSave()
81 //sets additional accel, eg. Key_A for ALT+Key_A
82 void ExitDialog::makeLetterAccel(QPushButton * btn)
85 if (btn->accel().count() < 1)
88 Q3Accel * a = new Q3Accel(btn);
89 a->connectItem(a->insertItem(btn->accel() & ~(Qt::MODIFIER_MASK | Qt::UNICODE_ACCEL)),
90 btn, SLOT(animateClick()));
92 #warning "Needs porting to Qt4... !!! FIX !!!"