X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=www%2Fapidoc%2Fhtml%2Fsettingsdialog_8cpp_source.html;fp=www%2Fapidoc%2Fhtml%2Fsettingsdialog_8cpp_source.html;h=fd79ed01590942768d7d1e4845da3081cd54b984;hb=30ce423868584b5d2d7aa066dd8408309a16e819;hp=0000000000000000000000000000000000000000;hpb=aa700f245d7c8ea96728266237f42691836baf74;p=urpo diff --git a/www/apidoc/html/settingsdialog_8cpp_source.html b/www/apidoc/html/settingsdialog_8cpp_source.html new file mode 100644 index 0000000..fd79ed0 --- /dev/null +++ b/www/apidoc/html/settingsdialog_8cpp_source.html @@ -0,0 +1,217 @@ + + + +
+ +00001 /************************************************************************** +00002 +00003 URPO +00004 +00005 Unix Remote Printing Operation +00006 Copyright (c) Arto Hyvättinen 2010 +00007 +00008 This file is part of URPO. +00009 +00010 URPO is free software: you can redistribute it and/or modify +00011 it under the terms of the GNU General Public License as published by +00012 the Free Software Foundation, either version 3 of the License, or +00013 (at your option) any later version. +00014 +00015 URPO is distributed in the hope that it will be useful, +00016 but WITHOUT ANY WARRANTY; without even the implied warranty of +00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +00018 GNU General Public License for more details. +00019 +00020 +00021 **************************************************************************/ +00022 +00023 #include "settingsdialog.h" +00024 +00025 #include <QLineEdit> +00026 #include <QPushButton> +00027 #include <QHBoxLayout> +00028 #include <QLabel> +00029 #include <QVBoxLayout> +00030 #include <QFileDialog> +00031 #include <QGroupBox> +00032 #include "urpoconnectionsettings.h" +00033 +00034 SettingsDialog::SettingsDialog(QWidget *parent) : +00035 QDialog(parent) +00036 { +00037 settings_ = 0; +00038 helpWidget_ = 0; +00039 +00040 +00041 setWindowTitle(tr("Urpo Settings")); +00042 +00043 serverEdit = new QLineEdit; +00044 connect(serverEdit, SIGNAL(textChanged(QString)), this, SLOT(serverChanged(QString))); +00045 +00046 userEdit = new QLineEdit; +00047 identityEdit = new QLineEdit; +00048 +00049 browseButton = new QPushButton(tr("Browse")); +00050 connect(browseButton, SIGNAL(clicked()),this,SLOT(browse())); +00051 okButton = new QPushButton(tr("Done")); +00052 connect(okButton, SIGNAL(clicked()), this, SLOT(okay()) ); +00053 okButton->setEnabled(false); +00054 +00055 helpButton = new QPushButton( tr("Help")); +00056 +00057 +00058 QVBoxLayout* mainLayout = new QVBoxLayout; +00059 +00060 QHBoxLayout* helpLayout = new QHBoxLayout; +00061 helpLayout->addWidget( new QLabel(tr("Remote printing utility " +00062 "via ssh and cups. " +00063 "Please read help."))); +00064 helpLayout->addWidget(helpButton); +00065 QGroupBox* helpBox = new QGroupBox(); +00066 helpBox->setLayout(helpLayout); +00067 helpBox->setFlat(false); +00068 mainLayout->addWidget(helpBox); +00069 +00070 +00071 QHBoxLayout* serverLayout = new QHBoxLayout; +00072 serverLayout->addWidget( new QLabel(tr("Host name or ip address"))); +00073 serverLayout->addWidget( serverEdit ); +00074 mainLayout->addLayout(serverLayout); +00075 +00076 QHBoxLayout* userLayout = new QHBoxLayout; +00077 userLayout->addWidget( new QLabel(tr("Username"))); +00078 userLayout->addWidget( userEdit ); +00079 mainLayout->addLayout(userLayout); +00080 +00081 QHBoxLayout* idLayout = new QHBoxLayout; +00082 idLayout->addWidget( new QLabel( tr("Identity file"))); +00083 idLayout->addWidget(identityEdit); +00084 idLayout->addWidget( browseButton); +00085 mainLayout->addLayout(idLayout); +00086 +00087 mainLayout->addStretch(); +00088 +00089 QHBoxLayout* okLayout = new QHBoxLayout; +00090 okLayout->addStretch(); +00091 okLayout->addWidget(okButton); +00092 mainLayout->addLayout(okLayout); +00093 +00094 setLayout(mainLayout); +00095 +00096 } +00097 +00098 +00099 void SettingsDialog::setSettings(UrpoConnectionSettings *settings) +00100 { +00101 // Init dialog from UrpoConnectionSetting +00102 settings_ = settings; +00103 serverEdit->setText( settings_->getHost()); +00104 userEdit->setText(settings_->getUserid()); +00105 identityEdit->setText(settings_->getIdentity()); +00106 +00107 } +00108 +00109 void SettingsDialog::setHelp(QTextBrowser *helpWidget) +00110 { +00111 // Set widget activated in help button +00112 helpWidget_ = helpWidget; +00113 connect( helpButton, SIGNAL(clicked()), this, SLOT(showHelp())); +00114 } +00115 +00116 void SettingsDialog::okay() +00117 { +00118 if( settings_ ) +00119 { +00120 // Store settings +00121 settings_->setHost( serverEdit->text()); +00122 settings_->setUserid( userEdit->text()); +00123 settings_->setIdentity( identityEdit->text()); +00124 +00125 settings_->store(); +00126 +00127 done(QDialog::Accepted); +00128 } +00129 else +00130 done(QDialog::Rejected); +00131 } +00132 +00133 void SettingsDialog::showHelp() +00134 { +00135 // Activate help window +00136 helpWidget_->home(); +00137 helpWidget_->show(); +00138 helpWidget_->raise(); +00139 helpWidget_->activateWindow(); +00140 } +00141 +00142 void SettingsDialog::serverChanged(const QString& text) +00143 { +00144 // If there is a server setting, dialog will be accepted +00145 // (if you have same userid in server and ssh key defined...) +00146 +00147 okButton->setDisabled( text.isEmpty() ); +00148 } +00149 +00150 void SettingsDialog::browse() +00151 { +00152 QString path = QFileDialog::getOpenFileName(this, tr("Identity file")); +00153 if(!path.isNull()) +00154 identityEdit->setText(path); +00155 } +