56 delete mMailboxSelectionDialog; |
56 delete mMailboxSelectionDialog; |
57 } |
57 } |
58 |
58 |
59 |
59 |
60 /*! |
60 /*! |
61 Initializes and displays the dialog. |
61 Initializes and displays the dialog |
62 |
62 Signal selectionDialogClosed will be emitted when the dialog is closed |
63 \param mailboxId Where the ID of the selected mailbox is stored. |
63 */ |
64 \return True if the user selected a mailbox, false otherwise. |
64 void NmMailboxSelectionDialog::open() |
65 */ |
|
66 bool NmMailboxSelectionDialog::exec(NmId& mailboxId) |
|
67 { |
65 { |
68 NMLOG("NmMailboxSelectionDialog::exec()"); |
66 NMLOG("NmMailboxSelectionDialog::exec()"); |
69 mMailboxId = 0; |
67 mMailboxId = 0; |
70 |
68 |
71 // Initialize the UI and fetch the mailbox items into the list. |
69 // Initialize the UI and fetch the mailbox items into the list. |
72 if (initializeUi() && populateListItems()) { |
70 if (initializeUi() && populateListItems()) { |
73 // The UI is ready. Do display the dialog. |
71 mMailboxSelectionDialog->setModal(true); |
74 mMailboxSelectionDialog->exec(); |
72 mMailboxSelectionDialog->open(this,SLOT(dialogClosed(HbAction*))); |
75 |
73 mMailboxSelectionDialog->show(); |
76 // Store the ID of the selected mailbox into the given argument. |
74 } |
77 mailboxId = mMailboxId; |
75 } |
78 } |
76 |
79 |
77 /*! |
80 return (mMailboxId != 0); |
78 Slot that is called when dialog is closed |
81 } |
79 */ |
82 |
80 void NmMailboxSelectionDialog::dialogClosed(HbAction *action) |
|
81 { |
|
82 Q_UNUSED(action); |
|
83 |
|
84 // Store the ID of the selected mailbox into the given argument. |
|
85 NMLOG(QString("NmMailboxSelectionDialog::dialogClosed() return %1"). |
|
86 arg(mMailboxId.id())); |
|
87 |
|
88 emit selectionDialogClosed(mMailboxId); |
|
89 } |
83 |
90 |
84 /*! |
91 /*! |
85 Creates the view for the mailbox selection dialog. |
92 Creates the view for the mailbox selection dialog. |
86 |
93 |
87 \return True if the widgets were loaded and set up successfully, false |
94 \return True if the widgets were loaded and set up successfully, false |