summaryrefslogtreecommitdiff
path: root/noncore/apps/odict/searchmethoddlg.cpp
Unidiff
Diffstat (limited to 'noncore/apps/odict/searchmethoddlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/searchmethoddlg.cpp77
1 files changed, 74 insertions, 3 deletions
diff --git a/noncore/apps/odict/searchmethoddlg.cpp b/noncore/apps/odict/searchmethoddlg.cpp
index cd8a58a..0572f11 100644
--- a/noncore/apps/odict/searchmethoddlg.cpp
+++ b/noncore/apps/odict/searchmethoddlg.cpp
@@ -25,12 +25,83 @@
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qpushbutton.h> 26#include <qpushbutton.h>
27#include <qstring.h> 27#include <qstring.h>
28#include <qlineedit.h>
28 29
29SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal) 30#include <opie/ofileselector.h>
31#include <opie/ofiledialog.h>
32
33SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal)
30{ 34{
31 setCaption( tr( "New Searchmethod" ) ); 35 if( !itemname )
36 setCaption( tr( "New Searchmethod" ) );
37 else
38 {
39 setCaption( tr( "Change Searchmethod" ) );
40 itemName = itemname;
41 setupEntries(itemname);
42 }
43
44 QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" );
45 QVBox *vbox = new QVBox( this );
46
47 QHBox *hbox1 = new QHBox( vbox );
48 QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 );
49 nameLE = new QLineEdit( hbox1 );
50
51 QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox );
52 QHBox *hbox2 = new QHBox( vbox );
53 dictFileLE = new QLineEdit( hbox2 );
54 QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 );
55 connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) );
56
57 QWidget *dummywidget = new QWidget( vbox );
58 QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget);
59 QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget);
60 QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget);
61 lang1 = new QLineEdit( dummywidget );
62 lang2 = new QLineEdit( dummywidget );
63 trenner = new QLineEdit( dummywidget );
64 trenner->setText( "::" );
65
66 QGridLayout *grid = new QGridLayout( dummywidget, 2,3 );
67 grid->addWidget( lag1, 0,0 );
68 grid->addWidget( devider, 0,1 );
69 grid->addWidget( lag2, 0,2 );
70 grid->addWidget( lang1, 1,0 );
71 grid->addWidget( trenner, 1,1 );
72 grid->addWidget( lang2, 1,2 );
73
74 vbox_layout->addWidget( vbox );
32 75
33 itemName = "foo";
34 showMaximized(); 76 showMaximized();
35} 77}
36 78
79void SearchMethodDlg::setupEntries( QString item )
80{
81 Config cfg( "odict" );
82 cfg.setGroup( itemName );
83 trenner->setText( "foooof" );
84 //X trenner->setText( cfg.readEntry( "Seperator" ) );
85 //X lang1->setText( cfg.readEntry( "Lang1" ) );
86 //X lang2->setText( cfg.readEntry( "Lang2" ) );
87 //X nameLE->setText( itemName );
88 //X dictFileLE->setText( cfg.readEntry( "file" ) );
89}
90
91void SearchMethodDlg::slotBrowse()
92{
93 itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,"/home/carsten" );
94 dictFileLE->setText( itemName );
95}
96
97void SearchMethodDlg::saveItem()
98{
99 QString name = nameLE->text();
100 Config cfg( "odict" );
101 cfg.setGroup( name );
102 cfg.writeEntry( "Name", name );
103 cfg.writeEntry( "Seperator", trenner->text() );
104 cfg.writeEntry( "Lang1", lang1->text() );
105 cfg.writeEntry( "Lang2", lang2->text() );
106 cfg.writeEntry( "file", dictFileLE->text() );
107}