1 #include "networkdialogedit.h"
2 #include "ui_networkdialogedit.h"
3 #include <QtCore/QStringList>
4 #include <QtCore/QDebug> //Debug pro informace
5 #include <QtGui/QItemSelectionModel>
6 #include <QtGui/QStandardItemModel>
7 #include <QMaemo5InformationBox>
8 #include <QMaemo5ValueButton>
9 #include <QMaemo5ListPickSelector>
10 #include <QMaemo5InformationBox>
11 #include <QtGui/QMessageBox>
16 NetWorkDialogEdit::NetWorkDialogEdit(QWidget *parent) :
18 ui(new Ui::NetWorkDialogEdit)
21 setWindowTitle(tr("Set profile forNetwork"));
22 selectedProfile = QString("");
27 NetWorkDialogEdit::~NetWorkDialogEdit()
32 void NetWorkDialogEdit::changeEvent(QEvent *e)
34 QDialog::changeEvent(e);
36 case QEvent::LanguageChange:
37 ui->retranslateUi(this);
45 Store profile names and create maemo button for show this names
46 \param list_of_profiles_nf list of profile names
48 void NetWorkDialogEdit::SetProfilenames(QStringList list_of_profiles_nf)
50 list_of_profiles = list_of_profiles_nf;
52 p_model_profile_names = new QStandardItemModel(this);//model for maemo 5 button
54 foreach(QString profile, list_of_profiles )
56 p_model_profile_names->appendRow(new QStandardItem(profile));
59 p_set_Profile_button = new QMaemo5ValueButton(tr("Choose profile for Network:"), this);
60 p_set_Profile_button->setValueLayout(QMaemo5ValueButton::ValueBesideText);
61 p_list_pick_profile = new QMaemo5ListPickSelector();
62 p_list_pick_profile->setModel(p_model_profile_names);
63 p_set_Profile_button->setPickSelector(p_list_pick_profile);
64 ui->verticalLayout->addWidget(p_set_Profile_button);
65 connect(p_list_pick_profile,SIGNAL(selected(QString)),this,SLOT(SelectedName(QString)));
69 Slot for change in list pick
70 \param name name of profile
72 void NetWorkDialogEdit::SelectedName(QString name)
74 selectedProfile = name;
79 \param id name of network
80 \param name text for label
82 void NetWorkDialogEdit::SetNameOfLabel(QString id, QString name )
84 ui->label->setText(name + id);
88 Return name of selected profile
91 QString NetWorkDialogEdit::GetNameProfile()
93 return selectedProfile;
99 QString NetWorkDialogEdit::GetNameOfRule()
101 return ui->lineEditNameOfrule->text();
106 \param name text for label
108 void NetWorkDialogEdit::SetNameOfRule(QString name)
110 ui->lineEditNameOfrule->setText(name);
114 Slot for signal when user click on save button.
115 Check is everyting is OK
117 void NetWorkDialogEdit::accept()
119 if(selectedProfile.isEmpty())
121 QMaemo5InformationBox::information(this, tr("Select profile for network"), QMaemo5InformationBox::DefaultTimeout);
125 if(ui->lineEditNameOfrule->text().isEmpty())
127 QMaemo5InformationBox::information(this, tr("Please fill name"), QMaemo5InformationBox::DefaultTimeout);
131 done(QDialog::Accepted);