2 This file is part of Faster Application Manager.
4 Faster Application Manager is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 Faster Application Manager is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with Faster Application Manager. If not, see <http://www.gnu.org/licenses/>.
17 (C) Heikki Holstila 2010
21 #include "ui_repoedit.h"
22 #include "repository.h"
23 #include "confirmdialog.h"
24 #include "aaptinterface.h"
26 RepoEdit::RepoEdit(AAptInterface* apt, Repository* repo, int pos, QWidget *parent) :
35 ui->lineEdit_name->setText( iRepo->name() );
36 ui->lineEdit_url->setText( iRepo->url()+iRepo->dir() );
37 ui->lineEdit_components->setText( iRepo->components() );
38 ui->lineEdit_dist->setText( iRepo->dist() );
39 ui->checkBox_Enabled->setChecked( iRepo->enabled() );
40 iRevertEnabledTo = iRepo->enabled();
42 on_lineEdit_name_textEdited("");
50 void RepoEdit::changeEvent(QEvent *e)
52 QDialog::changeEvent(e);
54 case QEvent::LanguageChange:
55 ui->retranslateUi(this);
62 void RepoEdit::on_btn_OK_clicked()
64 iRepo->set( ui->lineEdit_name->text().trimmed(), ui->lineEdit_url->text().trimmed(),
65 ui->lineEdit_dist->text().trimmed(), ui->lineEdit_components->text().trimmed(),
66 ui->checkBox_Enabled->isChecked() );
71 void RepoEdit::on_btn_Delete_clicked()
73 ConfirmDialog d(true, this);
74 d.setText("Confirmation","Really delete this repository?");
79 iAptInterface->repositories()->removeAt(iPos);
87 void RepoEdit::on_lineEdit_name_textEdited(QString )
89 QString n = ui->lineEdit_name->text();
90 QString u = ui->lineEdit_url->text();
92 if( n == "" || u == "" ) {
93 ui->btn_OK->setEnabled(false);
94 ui->checkBox_Enabled->setEnabled(false);
95 ui->checkBox_Enabled->setChecked(false);
99 if( !u.contains("://") ) {
100 ui->btn_OK->setEnabled(false);
101 ui->checkBox_Enabled->setEnabled(false);
102 ui->checkBox_Enabled->setChecked(false);
106 ui->btn_OK->setEnabled(true);
107 ui->checkBox_Enabled->setEnabled(true);
108 ui->checkBox_Enabled->setChecked(iRevertEnabledTo);
111 void RepoEdit::on_lineEdit_url_textEdited(QString )
113 on_lineEdit_name_textEdited("");
116 void RepoEdit::on_checkBox_Enabled_clicked()
118 iRevertEnabledTo = ui->checkBox_Enabled->isChecked();