9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: This module contains the implementation of IAUpdateDialogUtil class |
|
15 * member functions. |
15 * |
16 * |
16 */ |
17 */ |
|
18 #include <hblabel.h> |
|
19 #include <hbmessagebox.h> |
|
20 |
|
21 #include "iaupdatedialogutil.h" |
|
22 #include "iaupdatedialogobserver.h" |
|
23 #include "iaupdatedebug.h" |
17 |
24 |
18 |
25 |
19 |
26 |
20 // INCLUDE FILES |
27 IAUpdateDialogUtil::IAUpdateDialogUtil(QObject *parent, IAUpdateDialogObserver *observer) |
|
28 : QObject(parent), |
|
29 mObserver(observer) |
|
30 { |
|
31 IAUPDATE_TRACE("[IAUPDATE] IAUpdateDialogUtil::IAUpdateDialogUtil()"); |
|
32 } |
21 |
33 |
22 #include "iaupdatedialogutil.h" |
34 IAUpdateDialogUtil::~IAUpdateDialogUtil() |
23 #include "iaupdatedebug.h" |
35 { |
24 #include <iaupdate.rsg> |
36 IAUPDATE_TRACE("[IAUPDATE] IAUpdateDialogUtil::~IAUpdateDialogUtil()"); |
25 |
37 } |
26 #include <aknmessagequerydialog.h> // CAknMessageQueryDialog |
|
27 #include <aknnotewrappers.h> // CAknInformationNote |
|
28 #include <StringLoader.h> |
|
29 |
38 |
30 |
39 |
31 /******************************************************************************* |
40 void IAUpdateDialogUtil::showInformation(const QString &text, HbAction *primaryAction) |
32 * class TIAUpdateDialogParam |
41 { |
33 *******************************************************************************/ |
42 HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeInformation); |
|
43 messageBox->setText(text); |
|
44 int actionCount = messageBox->actions().count(); |
|
45 for (int i=actionCount-1; i >= 0; i--) |
|
46 { |
|
47 messageBox->removeAction(messageBox->actions().at(i)); |
|
48 } |
|
49 if (primaryAction) |
|
50 { |
|
51 messageBox->addAction(primaryAction); |
|
52 } |
|
53 messageBox->setTimeout(HbPopup::NoTimeout); |
|
54 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
|
55 messageBox->open(this,SLOT(finished(HbAction*))); |
|
56 } |
34 |
57 |
35 |
58 |
36 // ------------------------------------------------------------------------------- |
59 void IAUpdateDialogUtil::showQuestion(const QString &text, HbAction *primaryAction, HbAction *secondaryAction) |
37 // TIAUpdateDialogParam::TIAUpdateDialogParam |
60 { |
38 // |
61 HbMessageBox *messageBox = new HbMessageBox(HbMessageBox::MessageTypeQuestion); |
39 // ------------------------------------------------------------------------------- |
62 messageBox->setIconVisible(false); |
40 // |
63 messageBox->setText(text); |
41 TIAUpdateDialogParam::TIAUpdateDialogParam() |
64 int actionCount = messageBox->actions().count(); |
42 : iCountSuccessfull( KErrNotFound ), iCountCancelled( KErrNotFound ), |
65 for (int i=actionCount-1; i >= 0; i--) |
43 iCountFailed( KErrNotFound ), iResourceId( KErrNotFound ), iNode( NULL ), |
66 { |
44 iLinkObserver( NULL ) |
67 messageBox->removeAction(messageBox->actions().at(i)); |
45 { |
|
46 } |
68 } |
|
69 if (primaryAction) |
|
70 { |
|
71 messageBox->addAction(primaryAction); |
|
72 } |
|
73 if (secondaryAction) |
|
74 { |
|
75 messageBox->addAction(secondaryAction); |
|
76 } |
|
77 messageBox->setTimeout(HbPopup::NoTimeout); |
|
78 messageBox->setAttribute(Qt::WA_DeleteOnClose); |
|
79 messageBox->open(this,SLOT(finished(HbAction*))); |
|
80 } |
47 |
81 |
48 |
82 |
49 /******************************************************************************* |
83 void IAUpdateDialogUtil::showAgreement(HbAction *primaryAction, HbAction *secondaryAction) |
50 * class IAUpdateDialogUtil |
84 { |
51 *******************************************************************************/ |
85 HbMessageBox *agreementDialog = new HbMessageBox(HbMessageBox::MessageTypeQuestion); |
|
86 HbLabel *label = new HbLabel(agreementDialog); |
|
87 label->setHtml(QString("Disclaimer")); |
|
88 agreementDialog->setHeadingWidget(label); |
|
89 agreementDialog->setIconVisible(false); |
|
90 agreementDialog->setText("This application allows you to download and use applications and services provided by Nokia or third parties. Service Terms and Privacy Policy will apply. Nokia will not assume any liability or responsibility for the availability or third party applications or services. Before using the third party application or service, read the applicable terms of use.<br /><br />Use of this application involves transmission of data. Contact your network service provider for information about data transmission charges.<br /><br />(c) 2007-2010 Nokia. All rights reserved."); |
|
91 |
|
92 int actionCount = agreementDialog->actions().count(); |
|
93 for (int i=actionCount-1; i >= 0; i--) |
|
94 { |
|
95 agreementDialog->removeAction(agreementDialog->actions().at(i)); |
|
96 } |
|
97 if (primaryAction) |
|
98 { |
|
99 agreementDialog->addAction(primaryAction); |
|
100 } |
|
101 if (secondaryAction) |
|
102 { |
|
103 agreementDialog->addAction(secondaryAction); |
|
104 } |
|
105 agreementDialog->setTimeout(HbPopup::NoTimeout); |
|
106 agreementDialog->setAttribute(Qt::WA_DeleteOnClose); |
|
107 agreementDialog->open(this,SLOT(finished(HbAction*))); |
|
108 } |
52 |
109 |
53 |
110 |
54 //------------------------------------------------------------------------------ |
|
55 // IAUpdateDialogUtil::ShowMessageQueryL |
|
56 // |
|
57 //------------------------------------------------------------------------------ |
|
58 // |
|
59 void IAUpdateDialogUtil::ShowMessageQueryL(const TDesC& aTitle, const TDesC& aText) |
|
60 { |
|
61 TPtrC ptr = aText; |
|
62 CAknMessageQueryDialog* query = CAknMessageQueryDialog::NewL( ptr ); |
|
63 query->PrepareLC( R_IAUPDATE_MESSAGE_QUERY ); |
|
64 |
111 |
65 if ( aTitle.Length() != 0 ) |
112 void IAUpdateDialogUtil::finished(HbAction *action) |
66 { |
113 { |
67 CAknPopupHeadingPane* headingPane = query->Heading(); |
114 if (mObserver) |
68 headingPane->SetTextL( aTitle ); |
115 { |
69 } |
116 mObserver->dialogFinished(action); |
70 query->RunLD(); |
117 } |
71 } |
118 } |
72 |
|
73 |
|
74 //------------------------------------------------------------------------------ |
|
75 // IAUpdateDialogUtil::ShowMessageQueryL |
|
76 // |
|
77 //------------------------------------------------------------------------------ |
|
78 // |
|
79 void IAUpdateDialogUtil::ShowMessageQueryL( const TDesC& aTitle, TInt aResource ) |
|
80 { |
|
81 HBufC* hBuf = StringLoader::LoadLC( aResource ); |
|
82 ShowMessageQueryL( aTitle, hBuf->Des() ); |
|
83 CleanupStack::PopAndDestroy( hBuf ); |
|
84 } |
|
85 |
|
86 |
|
87 //------------------------------------------------------------------------------ |
|
88 // IAUpdateDialogUtil::ShowInformationQueryL |
|
89 // |
|
90 //------------------------------------------------------------------------------ |
|
91 // |
|
92 void IAUpdateDialogUtil::ShowInformationQueryL(const TDesC& aText) |
|
93 { |
|
94 CAknQueryDialog* queryDialog = new (ELeave) CAknQueryDialog; |
|
95 queryDialog->ExecuteLD(R_IAUPDATE_INFORMATION_QUERY, aText); |
|
96 } |
|
97 |
|
98 |
|
99 //------------------------------------------------------------------------------ |
|
100 // IAUpdateDialogUtil::ShowInformationQueryL |
|
101 // |
|
102 //------------------------------------------------------------------------------ |
|
103 // |
|
104 void IAUpdateDialogUtil::ShowInformationQueryL(TInt aResource) |
|
105 { |
|
106 HBufC* hBuf = StringLoader::LoadLC(aResource); |
|
107 ShowInformationQueryL( hBuf->Des() ); |
|
108 CleanupStack::PopAndDestroy( hBuf ); |
|
109 } |
|
110 |
|
111 //------------------------------------------------------------------------------ |
|
112 // IAUpdateDialogUtil::ShowConfirmationQueryL |
|
113 // |
|
114 //------------------------------------------------------------------------------ |
|
115 // |
|
116 TInt IAUpdateDialogUtil::ShowConfirmationQueryL( const TDesC& aText, |
|
117 TInt aSoftkeyResourceId ) |
|
118 { |
|
119 CAknQueryDialog* queryDialog = CAknQueryDialog::NewL( |
|
120 CAknQueryDialog::EConfirmationTone ); |
|
121 |
|
122 queryDialog->PrepareLC( R_IAUPDATE_CONFIRMATION_QUERY ); |
|
123 queryDialog->SetPromptL( aText ); |
|
124 queryDialog->ButtonGroupContainer().SetCommandSetL( aSoftkeyResourceId ); |
|
125 return ( queryDialog->RunLD() ); |
|
126 } |
|
127 |
|
128 //------------------------------------------------------------------------------ |
|
129 // IAUpdateDialogUtil::ShowConfirmationQueryL |
|
130 // |
|
131 //------------------------------------------------------------------------------ |
|
132 // |
|
133 TInt IAUpdateDialogUtil::ShowConfirmationQueryL( TInt aResource, |
|
134 TInt aSoftkeyResourceId ) |
|
135 { |
|
136 HBufC* hBuf = StringLoader::LoadLC( aResource) ; |
|
137 TInt ret = ShowConfirmationQueryL( *hBuf, aSoftkeyResourceId ); |
|
138 CleanupStack::PopAndDestroy( hBuf ); |
|
139 return ret; |
|
140 } |
|
141 |
119 |
142 |
120 |
143 |
121 |
144 |
122 |
145 // ----------------------------------------------------------------------------- |
123 |
146 // IAUpdateDialogUtil::Panic |
124 |
147 // |
|
148 // ----------------------------------------------------------------------------- |
|
149 // |
|
150 void IAUpdateDialogUtil::Panic( TInt aReason ) |
|
151 { |
|
152 _LIT(KPanicCategory, "IAUpdateDialogUtil"); |
|
153 |
|
154 User::Panic(KPanicCategory, aReason); |
|
155 } |
|
156 |
|
157 // End of File |
|