summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/searchmethoddlg.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/noncore/apps/odict/searchmethoddlg.cpp b/noncore/apps/odict/searchmethoddlg.cpp
index 0572f11..fcbdb8a 100644
--- a/noncore/apps/odict/searchmethoddlg.cpp
+++ b/noncore/apps/odict/searchmethoddlg.cpp
@@ -11,97 +11,97 @@
11 * This program is free software; you can redistribute it and/or modify * 11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by * 12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or * 13 * the Free Software Foundation; either version 2 of the License, or *
14 * ( at your option ) any later version. * 14 * ( at your option ) any later version. *
15 * * 15 * *
16 **************************************************************************/ 16 **************************************************************************/
17#include "searchmethoddlg.h" 17#include "searchmethoddlg.h"
18 18
19#include <qdialog.h> 19#include <qdialog.h>
20#include <qpe/config.h> 20#include <qpe/config.h>
21#include <qlayout.h> 21#include <qlayout.h>
22 22
23#include <qhbox.h> 23#include <qhbox.h>
24#include <qvbox.h> 24#include <qvbox.h>
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#include <qlineedit.h>
29 29
30#include <opie/ofileselector.h> 30#include <opie/ofileselector.h>
31#include <opie/ofiledialog.h> 31#include <opie/ofiledialog.h>
32 32
33SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal) 33SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal)
34{ 34{
35 if( !itemname )
36 setCaption( tr( "New Searchmethod" ) );
37 else
38 {
39 setCaption( tr( "Change Searchmethod" ) );
40 itemName = itemname;
41 setupEntries(itemname);
42 }
43 35
44 QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" ); 36 QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" );
45 QVBox *vbox = new QVBox( this ); 37 QVBox *vbox = new QVBox( this );
46 38
47 QHBox *hbox1 = new QHBox( vbox ); 39 QHBox *hbox1 = new QHBox( vbox );
48 QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 ); 40 QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 );
49 nameLE = new QLineEdit( hbox1 ); 41 nameLE = new QLineEdit( hbox1 );
50 42
51 QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox ); 43 QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox );
52 QHBox *hbox2 = new QHBox( vbox ); 44 QHBox *hbox2 = new QHBox( vbox );
53 dictFileLE = new QLineEdit( hbox2 ); 45 dictFileLE = new QLineEdit( hbox2 );
54 QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 ); 46 QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 );
55 connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) ); 47 connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) );
56 48
57 QWidget *dummywidget = new QWidget( vbox ); 49 QWidget *dummywidget = new QWidget( vbox );
58 QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget); 50 QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget);
59 QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget); 51 QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget);
60 QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget); 52 QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget);
61 lang1 = new QLineEdit( dummywidget ); 53 lang1 = new QLineEdit( dummywidget );
62 lang2 = new QLineEdit( dummywidget ); 54 lang2 = new QLineEdit( dummywidget );
63 trenner = new QLineEdit( dummywidget ); 55 trenner = new QLineEdit( dummywidget );
64 trenner->setText( "::" ); 56 trenner->setText( "::" );
65 57
66 QGridLayout *grid = new QGridLayout( dummywidget, 2,3 ); 58 QGridLayout *grid = new QGridLayout( dummywidget, 2,3 );
67 grid->addWidget( lag1, 0,0 ); 59 grid->addWidget( lag1, 0,0 );
68 grid->addWidget( devider, 0,1 ); 60 grid->addWidget( devider, 0,1 );
69 grid->addWidget( lag2, 0,2 ); 61 grid->addWidget( lag2, 0,2 );
70 grid->addWidget( lang1, 1,0 ); 62 grid->addWidget( lang1, 1,0 );
71 grid->addWidget( trenner, 1,1 ); 63 grid->addWidget( trenner, 1,1 );
72 grid->addWidget( lang2, 1,2 ); 64 grid->addWidget( lang2, 1,2 );
73 65
74 vbox_layout->addWidget( vbox ); 66 vbox_layout->addWidget( vbox );
75 67
76 showMaximized(); 68 showMaximized();
69
70 if( !itemname )
71 setCaption( tr( "New Searchmethod" ) );
72 else
73 {
74 setCaption( tr( "Change Searchmethod" ) );
75 itemName = itemname;
76 setupEntries(itemname);
77 }
77} 78}
78 79
79void SearchMethodDlg::setupEntries( QString item ) 80void SearchMethodDlg::setupEntries( QString item )
80{ 81{
81 Config cfg( "odict" ); 82 Config cfg( "odict" );
82 cfg.setGroup( itemName ); 83 cfg.setGroup( itemName );
83 trenner->setText( "foooof" ); 84 trenner->setText( cfg.readEntry( "Seperator" ) );
84 //X trenner->setText( cfg.readEntry( "Seperator" ) ); 85 lang1->setText( cfg.readEntry( "Lang1" ) );
85 //X lang1->setText( cfg.readEntry( "Lang1" ) ); 86 lang2->setText( cfg.readEntry( "Lang2" ) );
86 //X lang2->setText( cfg.readEntry( "Lang2" ) ); 87 nameLE->setText( itemName );
87 //X nameLE->setText( itemName ); 88 dictFileLE->setText( cfg.readEntry( "file" ) );
88 //X dictFileLE->setText( cfg.readEntry( "file" ) );
89} 89}
90 90
91void SearchMethodDlg::slotBrowse() 91void SearchMethodDlg::slotBrowse()
92{ 92{
93 itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,"/home/carsten" ); 93 itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,"/home/carsten" );
94 dictFileLE->setText( itemName ); 94 dictFileLE->setText( itemName );
95} 95}
96 96
97void SearchMethodDlg::saveItem() 97void SearchMethodDlg::saveItem()
98{ 98{
99 QString name = nameLE->text(); 99 QString name = nameLE->text();
100 Config cfg( "odict" ); 100 Config cfg( "odict" );
101 cfg.setGroup( name ); 101 cfg.setGroup( name );
102 cfg.writeEntry( "Name", name ); 102 cfg.writeEntry( "Name", name );
103 cfg.writeEntry( "Seperator", trenner->text() ); 103 cfg.writeEntry( "Seperator", trenner->text() );
104 cfg.writeEntry( "Lang1", lang1->text() ); 104 cfg.writeEntry( "Lang1", lang1->text() );
105 cfg.writeEntry( "Lang2", lang2->text() ); 105 cfg.writeEntry( "Lang2", lang2->text() );
106 cfg.writeEntry( "file", dictFileLE->text() ); 106 cfg.writeEntry( "file", dictFileLE->text() );
107} 107}