summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/profileeditordialog.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-console/profileeditordialog.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-console/profileeditordialog.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/noncore/apps/opie-console/profileeditordialog.cpp b/noncore/apps/opie-console/profileeditordialog.cpp
index dc42d8b..8109070 100644
--- a/noncore/apps/opie-console/profileeditordialog.cpp
+++ b/noncore/apps/opie-console/profileeditordialog.cpp
@@ -1,45 +1,41 @@
+#include "profileeditordialog.h"
+#include "metafactory.h"
+#include "comboboxhelper.h"
+
+
#include <qlayout.h>
#include <qlineedit.h>
#include <qlabel.h>
#include <qmessagebox.h>
#include <qcombobox.h>
#include <qcheckbox.h>
#include <qscrollview.h>
-#include "metafactory.h"
-#include "profileeditordialog.h"
+
using namespace Opie::Ui;
-namespace {
- void setCurrent( const QString& str, QComboBox* bo ) {
- for (int i = 0; i < bo->count(); i++ ) {
- if ( bo->text(i) == str ) {
- bo->setCurrentItem( i );
- }
- }
- };
-}
+
ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact,
const Profile& prof )
: QDialog(0, 0, TRUE), m_fact( fact ), m_prof( prof )
{
initUI();
// Apply current profile
// plugin_plugin->load(profile);
// ... (reset profile name line edit etc.)
}
ProfileEditorDialog::ProfileEditorDialog( MetaFactory* fact )
: QDialog(0, 0, TRUE), m_fact( fact )
{
// Default profile
m_prof = Profile(tr("New Profile"), "serial", "default", Profile::Black, Profile::White, Profile::VT102);
initUI();
// Apply current profile
// plugin_plugin->load(profile);
}
@@ -103,50 +99,50 @@ void ProfileEditorDialog::initUI()
vbox3->addStretch(1);
m_showconntab = 0;
tabWidget->addTab(tabprof, "", QObject::tr("Profile"));
tabWidget->addTab(m_tabCon, "", QObject::tr("Connection"));
tabWidget->addTab(m_tabTerm, "", QObject::tr("Terminal"));
tabWidget->addTab(m_tabKey, "", QObject::tr("Special Keys"));
tabWidget->setCurrentTab( tabprof );
// fill the comboboxes
QStringList list = m_fact->connectionWidgets();
QStringList::Iterator it;
for (it =list.begin(); it != list.end(); ++it ) {
m_conCmb->insertItem( (*it) );
}
list = m_fact->terminalWidgets();
for (it =list.begin(); it != list.end(); ++it ) {
m_termCmb->insertItem( (*it) );
}
// load profile values
m_name->setText(m_prof.name());
slotKeyActivated( "Default Keyboard" );
- setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb );
- setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb );
+ ComboboxHelper::setCurrent( m_fact->external(m_prof.ioLayerName() ), m_conCmb );
+ ComboboxHelper::setCurrent( m_fact->external(m_prof.terminalName() ), m_termCmb );
slotConActivated( m_fact->external(m_prof.ioLayerName() ) );
slotTermActivated( m_fact->external(m_prof.terminalName() ) );
m_autoConnect->setChecked(m_prof.autoConnect());
// signal and slots
connect(m_conCmb, SIGNAL(activated(const QString&) ),
this, SLOT(slotConActivated(const QString&) ) );
connect(m_termCmb, SIGNAL(activated(const QString&) ),
this, SLOT(slotTermActivated(const QString&) ) );
}
ProfileEditorDialog::~ProfileEditorDialog() {
}
void ProfileEditorDialog::accept()
{
if(profName().isEmpty())
{
QMessageBox::information(this,
QObject::tr("Invalid profile"),
QObject::tr("Please enter a profile name."));
return;