|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <hbapplication.h> |
|
19 #include <hbinstance.h> |
|
20 |
|
21 #include "hbaction.h" |
|
22 #include "hbmenu.h" |
|
23 #include "commonActions.h" |
|
24 #include "notifications.h" |
|
25 #include "enginewrapper.h" |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 |
|
29 CommonActions::CommonActions(EngineWrapper *engine, HbApplication *application) |
|
30 : mEngine(engine), mApplication(application) |
|
31 { |
|
32 |
|
33 |
|
34 mActionStopLaunch = new HbAction("Stop launch", this); |
|
35 mActionSendLog = new HbAction("Send log", this); |
|
36 mActionDeleteLog = new HbAction("Delete log", this); |
|
37 mActionSendDllInfo = new HbAction("Send list of DLLs", this); |
|
38 mActionCompareDllInfo = new HbAction("Dll BC analysis", this); |
|
39 mActionAbout = new HbAction("About", this); |
|
40 mActionExit = new HbAction("Exit", this); |
|
41 |
|
42 |
|
43 connectSignalsAndSlots(); |
|
44 } |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 |
|
48 CommonActions::~CommonActions() |
|
49 { |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 |
|
54 void CommonActions::showAbout() |
|
55 { |
|
56 Notifications::about(); |
|
57 } |
|
58 |
|
59 // --------------------------------------------------------------------------- |
|
60 |
|
61 void CommonActions::exit() |
|
62 { |
|
63 mApplication->exit(); |
|
64 } |
|
65 |
|
66 // --------------------------------------------------------------------------- |
|
67 |
|
68 void CommonActions::sendDllInfo() |
|
69 { |
|
70 if (!mEngine->sendListOfDlls()) { |
|
71 Notifications::showErrorNote("Unable to send list"); |
|
72 } |
|
73 |
|
74 } |
|
75 |
|
76 // --------------------------------------------------------------------------- |
|
77 |
|
78 void CommonActions::compareDllInfo() |
|
79 { |
|
80 mEngine->compareDlls(); |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 |
|
85 void CommonActions::sendLog() |
|
86 { |
|
87 if (!mEngine->sendLog()) { |
|
88 Notifications::showErrorNote("Unable to send log"); |
|
89 } |
|
90 } |
|
91 |
|
92 // --------------------------------------------------------------------------- |
|
93 |
|
94 void CommonActions::deleteLog() |
|
95 { |
|
96 if (mEngine->deleteLog()) { |
|
97 QString text = "Log file(s) deleted"; |
|
98 Notifications::showInformationNote(text); |
|
99 } |
|
100 else { |
|
101 QString text = "Unable to delete"; |
|
102 Notifications::showErrorNote(text); |
|
103 } |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 |
|
108 void CommonActions::stopLaunch() |
|
109 { |
|
110 if (!mEngine->stopLaunching()) { |
|
111 Notifications::showErrorNote("Unable to stop launching"); |
|
112 } |
|
113 } |
|
114 |
|
115 // --------------------------------------------------------------------------- |
|
116 |
|
117 void CommonActions::addActionsToMenu(HbMenu *menu) |
|
118 { |
|
119 menu->addAction(mActionStopLaunch); |
|
120 menu->addAction(mActionSendLog); |
|
121 menu->addAction(mActionDeleteLog); |
|
122 HbMenu *menuDllInfo = menu->addMenu("Dll Info"); |
|
123 menuDllInfo->addAction(mActionSendDllInfo); |
|
124 menuDllInfo->addAction(mActionCompareDllInfo); |
|
125 menu->addAction(mActionAbout); |
|
126 menu->addAction(mActionExit); |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 |
|
131 void CommonActions::connectSignalsAndSlots() |
|
132 { |
|
133 connect(mActionStopLaunch, SIGNAL(triggered()), this, SLOT(stopLaunch())); |
|
134 connect(mActionSendDllInfo, SIGNAL(triggered()), this, SLOT(sendDllInfo())); |
|
135 connect(mActionCompareDllInfo, SIGNAL(triggered()), this, SLOT(compareDllInfo())); |
|
136 connect(mActionSendLog, SIGNAL(triggered()), this, SLOT(sendLog())); |
|
137 connect(mActionDeleteLog, SIGNAL(triggered()), this, SLOT(deleteLog())); |
|
138 connect(mActionAbout, SIGNAL(triggered()), this, SLOT(showAbout())); |
|
139 connect(mActionExit, SIGNAL(triggered()), this, SLOT( exit() ) ); |
|
140 } |
|
141 |
|
142 |
|
143 // --------------------------------------------------------------------------- |