|
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 * This items represents one Destination in UI. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef CPDESTINATIONENTRYITEM_H |
|
20 #define CPDESTINATIONENTRYITEM_H |
|
21 |
|
22 // System includes |
|
23 #include <QSharedPointer> |
|
24 #include <cpsettingformentryitemdata.h> |
|
25 #include <cmmanagerdefines_shim.h> |
|
26 |
|
27 // User includes |
|
28 |
|
29 // Forward declarations |
|
30 class QString; |
|
31 class HbMenu; |
|
32 class HbView; |
|
33 class HbListWidget; |
|
34 class HbListWidgetItem; |
|
35 class HbMainWindow; |
|
36 class HbAction; |
|
37 class HbInputDialog; |
|
38 class CpItemDataHelper; |
|
39 class CpIapItem; |
|
40 class CmConnectionMethodShim; |
|
41 class CmManagerShim; |
|
42 |
|
43 // External data types |
|
44 |
|
45 // Constants |
|
46 |
|
47 // Class declaration |
|
48 class CpDestinationEntryItemData : public CpSettingFormEntryItemData |
|
49 { |
|
50 Q_OBJECT |
|
51 public: |
|
52 explicit CpDestinationEntryItemData(CpItemDataHelper &itemDataHelper); |
|
53 virtual ~CpDestinationEntryItemData(); |
|
54 |
|
55 int destinationId(); |
|
56 void setDestinationId( int destId ); |
|
57 QString destinationName(); |
|
58 void setDestinationName(const QString destinationName); |
|
59 |
|
60 signals: |
|
61 void destChanged(); |
|
62 |
|
63 public slots: |
|
64 void updateDestinationView(); |
|
65 void showItemMenu(QPointF position); |
|
66 void renameDestination(); |
|
67 void confirmDestinationDelete(); |
|
68 void deleteDestination(); |
|
69 void activateArrangeMode(); |
|
70 void viewDone(); |
|
71 void viewCancel(); |
|
72 void updateIndex(HbListWidgetItem *widgetItem); |
|
73 void saveNewDestinationName(); |
|
74 |
|
75 protected: |
|
76 |
|
77 protected slots: |
|
78 |
|
79 private: |
|
80 virtual CpBaseSettingView *createSettingView() const; |
|
81 void fetchReferencedAps( |
|
82 QList<QSharedPointer<CmConnectionMethodShim> > &apList, const CmManagerShim *cmm) const; |
|
83 bool isDestinationNameValid(QString &destination, const CmManagerShim *cmm); |
|
84 void createArrangeModeView(HbView *view); |
|
85 void constructSettingView(CpBaseSettingView *view) const; |
|
86 HbMenu *createItemMenu( |
|
87 CMManagerShim::CmmProtectionLevel protLvl, |
|
88 const QPointF position); |
|
89 void lauchNewDestinationNameQuery(); |
|
90 void showRenameError(const QString &info); |
|
91 void showErrorNote(const QString &info); |
|
92 |
|
93 private slots: |
|
94 |
|
95 private: // data |
|
96 |
|
97 //! Helper for connecting signals to underlying widgets |
|
98 CpItemDataHelper *mItemDataHelper; |
|
99 //! Unique Destination ID |
|
100 int mDestinationId; |
|
101 //! Destination Name |
|
102 QString mDestinationName; |
|
103 //! List of access points contained by this object |
|
104 QList<CpIapItem*> *mAps; |
|
105 //! Pointer to CmManager for commsdat operations |
|
106 CmManagerShim *mCmm; |
|
107 //! Previous view when arrange mode view is shown |
|
108 HbView *mPreView; |
|
109 //! List of access points for arrange mode |
|
110 HbListWidget *mList; |
|
111 //! New Destination name query dialog |
|
112 HbInputDialog *mDialog; |
|
113 //! New Destination name query's OK action |
|
114 HbAction *mOkAction; |
|
115 |
|
116 //! Maximun length for destination name |
|
117 static const int DestinationNameMaxLength = 30; |
|
118 }; |
|
119 |
|
120 #endif /* CPDESTINATIONENTRYITEM_H */ |