author | zecke <zecke> | 2004-07-15 17:29:39 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-15 17:29:39 (UTC) |
commit | aa292b322f1ecb43dd8f4e3cd295855730dd9f59 (patch) (unidiff) | |
tree | 63238dd550aee1007902af07c35bcc8bb6480fa1 | |
parent | ca486a4558dc7aa23e3e5c677f6eedd26ed02746 (diff) | |
download | opie-aa292b322f1ecb43dd8f4e3cd295855730dd9f59.zip opie-aa292b322f1ecb43dd8f4e3cd295855730dd9f59.tar.gz opie-aa292b322f1ecb43dd8f4e3cd295855730dd9f59.tar.bz2 |
-Change order of includes. Include "qpedialog.h" first
-In regards to precompiled headers drop the 'protected -> public define hack'
and use TrollTechs solution inspired from QETWidget to static_cast to
a private reimplementation to change the method. This was taken from
Qtopia
-rw-r--r-- | library/qpedialog.cpp | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/library/qpedialog.cpp b/library/qpedialog.cpp index da461b7..87d61e3 100644 --- a/library/qpedialog.cpp +++ b/library/qpedialog.cpp | |||
@@ -9,66 +9,76 @@ | |||
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #define protected public | 21 | #include "qpedialog.h" |
22 | |||
22 | #include <qdialog.h> | 23 | #include <qdialog.h> |
23 | #undef protected | ||
24 | 24 | ||
25 | #include "qpedialog.h" | 25 | #include "qpeapplication.h" |
26 | #include <qpe/qpeapplication.h> | 26 | |
27 | |||
28 | // Allow access to nornally protected accept and reject functions | ||
29 | class HackedPrivateQDialog : public QDialog{ | ||
30 | public: | ||
31 | void accept() { QDialog::accept();} | ||
32 | void reject() { QDialog::reject();} | ||
33 | }; | ||
27 | 34 | ||
28 | 35 | ||
29 | /** | 36 | /** |
30 | * \brief This is the only c'tor. | 37 | * \brief This is the only c'tor. |
31 | * | 38 | * |
32 | * The parent of this Listener is the Dialog you pass. This means once | 39 | * The parent of this Listener is the Dialog you pass. This means once |
33 | * the dialog is deleted this listener will be deleted too. | 40 | * the dialog is deleted this listener will be deleted too. |
34 | * This Listener listens on QPEApplication::appMessage signal and implements | 41 | * This Listener listens on QPEApplication::appMessage signal and implements |
35 | * accept() and reject(). | 42 | * accept() and reject(). |
36 | * | 43 | * |
37 | * \code | 44 | * \code |
38 | *QDialog *dialog = new YourDialog(); | 45 | *QDialog *dialog = new YourDialog(); |
39 | (void)new QPEDialogListener(dialog); | 46 | (void)new QPEDialogListener(dialog); |
40 | if( QPEApplication::execDialog(dialog) == QDialog::Accept ){ | 47 | if( QPEApplication::execDialog(dialog) == QDialog::Accept ){ |
41 | // do some stuff | 48 | // do some stuff |
42 | } | 49 | } |
43 | delete dialog; | 50 | delete dialog; |
44 | 51 | ||
45 | * \endcode | 52 | * \endcode |
46 | * | 53 | * |
47 | * @param di The dialog to handle | 54 | * @param di The dialog to handle |
48 | */ | 55 | */ |
49 | QPEDialogListener::QPEDialogListener(QDialog *di ) : QObject(di) | 56 | QPEDialogListener::QPEDialogListener(QDialog *di ) : QObject(di) |
50 | { | 57 | { |
51 | dialog = di; | 58 | dialog = di; |
52 | connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), | 59 | connect(qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
53 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); | 60 | this, SLOT(appMessage(const QCString&,const QByteArray&)) ); |
54 | } | 61 | } |
55 | 62 | ||
56 | 63 | ||
57 | /** | 64 | /** |
58 | * d'tor | 65 | * d'tor |
59 | */ | 66 | */ |
60 | QPEDialogListener::~QPEDialogListener() {} | 67 | QPEDialogListener::~QPEDialogListener() {} |
61 | 68 | ||
62 | /** | 69 | /** |
63 | * \internal | 70 | * \internal |
64 | */ | 71 | */ |
65 | void QPEDialogListener::appMessage( const QCString &msg, const QByteArray & ) | 72 | void QPEDialogListener::appMessage( const QCString &msg, const QByteArray & ) |
66 | { | 73 | { |
67 | if (!dialog) | 74 | if (!dialog) |
68 | return; | 75 | return; |
76 | |||
77 | HackedPrivateQDialog *hackedDialog = static_cast<HackedPrivateQDialog*>(dialog); | ||
78 | |||
69 | if (msg == "accept()") { | 79 | if (msg == "accept()") { |
70 | dialog->accept(); | 80 | hackedDialog->accept(); |
71 | } else if (msg == "reject()") { | 81 | } else if (msg == "reject()") { |
72 | dialog->reject(); | 82 | hackedDialog->reject(); |
73 | } | 83 | } |
74 | } | 84 | } |