summaryrefslogtreecommitdiff
path: root/noncore/apps
Side-by-side diff
Diffstat (limited to 'noncore/apps') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp40
-rw-r--r--noncore/apps/opie-console/profileeditordialog.h3
2 files changed, 31 insertions, 12 deletions
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index 1765d42..9890c3e 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -1,20 +1,20 @@
#include <qlayout.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qmessagebox.h>
#include <qstringlist.h>
#include <qcombobox.h>
#include <qcheckbox.h>
-
+#include <qscrollview.h>
//#include "profileeditorplugins.h"
#include "metafactory.h"
#include "profileeditordialog.h"
namespace {
void setCurrent( const QString& str, QComboBox* bo ) {
for (int i = 0; i < bo->count(); i++ ) {
if ( bo->text(i) == str ) {
bo->setCurrentItem( i );
}
}
@@ -44,40 +44,53 @@ ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
// plugin_plugin->load(profile);
}
Profile ProfileEditorDialog::profile() const
{
return m_prof;
}
void ProfileEditorDialog::initUI()
{
m_con = m_term = m_key = 0l;
+
QVBoxLayout *mainLayout = new QVBoxLayout( this );
tabWidget = new OTabWidget( this );
tabWidget->setTabStyle(OTabWidget::TextTab);
mainLayout->add(tabWidget);
/* base tabs */
tabprof = new QWidget(this);
m_tabTerm = new QWidget(this);
m_tabCon = new QWidget(this);
m_tabKey = new QWidget(this);
+ m_svCon = new QScrollView( m_tabCon );
+ m_svCon->setResizePolicy( QScrollView::AutoOneFit );
+ m_svCon->setHScrollBarMode( QScrollView::AlwaysOff );
+ m_svCon->setFrameShape( QFrame::NoFrame );
+ m_svTerm = new QScrollView( m_tabTerm );
+ m_svTerm->setResizePolicy( QScrollView::AutoOneFit );
+ m_svTerm->setHScrollBarMode( QScrollView::AlwaysOff );
+ m_svTerm->setFrameShape( QFrame::NoFrame );
+
/* base layout for tabs */
m_layCon = new QHBoxLayout( m_tabCon , 2 );
m_layTerm = new QHBoxLayout( m_tabTerm, 2 );
m_layKey = new QHBoxLayout( m_tabKey, 2 );
+ m_layCon->addWidget( m_svCon );
+ m_layTerm->addWidget( m_svTerm );
+
// profile tab
QLabel *name = new QLabel(QObject::tr("Profile name"), tabprof);
m_name = new QLineEdit(tabprof);
QLabel *con = new QLabel(tr("Connection"), tabprof );
QLabel *term = new QLabel(tr("Terminal"), tabprof );
m_conCmb = new QComboBox( tabprof );
m_termCmb = new QComboBox( tabprof );
m_autoConnect = new QCheckBox(tr("Auto connect after load"), tabprof);
// layouting
QVBoxLayout *vbox3 = new QVBoxLayout(tabprof, 2);
@@ -134,28 +147,28 @@ void ProfileEditorDialog::accept()
{
if(profName().isEmpty())
{
QMessageBox::information(this,
QObject::tr("Invalid profile"),
QObject::tr("Please enter a profile name."));
return;
}
// Save profile and plugin profile
//if(plugin_plugin) plugin_plugin->save();
// Save general values
- m_prof.setName(profName());
- m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) );
+ m_prof.setName( profName() );
+ m_prof.setIOLayer( m_fact->internal(m_conCmb ->currentText() ) );
m_prof.setTerminalName( m_fact->internal(m_termCmb->currentText() ) );
- m_prof.setAutoConnect( m_autoConnect->isChecked() );
+ m_prof.setAutoConnect( m_autoConnect->isChecked() );
if (m_con )
m_con->save( m_prof );
if (m_term )
m_term->save( m_prof );
if (m_key)
m_key->save( m_prof );
QDialog::accept();
}
@@ -167,46 +180,49 @@ QString ProfileEditorDialog::profName()const
QCString ProfileEditorDialog::profType()const
{
/*QStringList w = m_fact->configWidgets();
for(QStringList::Iterator it = w.begin(); it != w.end(); it++)
if(device_box->currentText() == m_fact->name((*it))) return (*it);
*/
return QCString();
}
/*
* we need to switch the widget
*/
void ProfileEditorDialog::slotConActivated( const QString& str ) {
+
delete m_con;
- m_con = m_fact->newConnectionPlugin( str, m_tabCon );
+
+ m_con = m_fact->newConnectionPlugin( str, m_svCon->viewport() );
if ( !m_con ) {
- m_con = new NoOptions( str, m_tabCon, "name");
+ m_con = new NoOptions( str, m_svCon->viewport(), "name");
}
m_con->load( m_prof );
- m_layCon->addWidget( m_con );
+ m_svCon->addChild( m_con );
+}
- tabWidget->setCurrentTab( tabprof );
-}
/*
* we need to switch the widget
*/
void ProfileEditorDialog::slotTermActivated( const QString& str ) {
+
delete m_term;
- m_term = m_fact->newTerminalPlugin( str, m_tabTerm );
+
+ m_term = m_fact->newTerminalPlugin( str, m_svTerm->viewport() );
if (m_term) {
- m_term->load(m_prof );
- m_layTerm->addWidget( m_term );
+ m_term->load( m_prof );
+ m_svTerm->addChild( m_term );
}
}
void ProfileEditorDialog::slotKeyActivated(const QString &str) {
delete m_key;
m_key = m_fact->newKeyboardPlugin( str, m_tabKey );
if (m_key) {
m_key->load(m_prof);
m_layKey->addWidget(m_key);
}
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h
index 6216660..c731747 100644
--- a/noncore/apps/opie-console/profileeditordialog.h
+++ b/noncore/apps/opie-console/profileeditordialog.h
@@ -5,24 +5,25 @@
#include <opie/otabwidget.h>
#include "profile.h"
class MetaFactory;
class EditBase;
class QTabWidget;
class QHBoxLayout;
class QLineEdit;
class QComboBox;
class QCheckBox;
class QLabel;
+class QScrollView;
class ProfileDialogWidget;
class ProfileEditorDialog : public QDialog {
Q_OBJECT
public:
ProfileEditorDialog(MetaFactory* fact,
const Profile& prof );
ProfileEditorDialog(MetaFactory* fact );
~ProfileEditorDialog();
Profile profile()const;
@@ -38,21 +39,23 @@ private:
void initUI();
QString profName()const;
QCString profType()const;
MetaFactory* m_fact;
QHBoxLayout* m_lay;
Profile m_prof;
QLineEdit *m_name;
QComboBox *m_conCmb, *m_termCmb;
QCheckBox *m_autoConnect;
+ QScrollView *m_svCon, *m_svTerm;
+
QWidget *m_tabCon, *m_tabTerm, *m_tabKey;
ProfileDialogWidget* m_con, *m_term, *m_key;
QHBoxLayout *m_layCon, *m_layTerm, *m_layKey;
OTabWidget *tabWidget;
QWidget *tabprof;
int m_showconntab;
};
#endif