summaryrefslogtreecommitdiff
path: root/noncore
Unidiff
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/dingwidget.cpp4
-rw-r--r--noncore/apps/odict/searchmethoddlg.cpp3
2 files changed, 5 insertions, 2 deletions
diff --git a/noncore/apps/odict/dingwidget.cpp b/noncore/apps/odict/dingwidget.cpp
index ac7c321..5939000 100644
--- a/noncore/apps/odict/dingwidget.cpp
+++ b/noncore/apps/odict/dingwidget.cpp
@@ -7,52 +7,54 @@
7 **************************************************************************/ 7 **************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
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 "dingwidget.h" 17#include "dingwidget.h"
18 18
19#include <qfile.h> 19#include <qfile.h>
20#include <qpe/config.h> 20#include <qpe/config.h>
21#include <qhbox.h> 21#include <qhbox.h>
22#include <qlabel.h> 22#include <qlabel.h>
23#include <qpushbutton.h> 23#include <qpushbutton.h>
24#include <qlineedit.h> 24#include <qlineedit.h>
25#include <qmainwindow.h> 25#include <qmainwindow.h>
26#include <qstring.h> 26#include <qstring.h>
27#include <qtextstream.h> 27#include <qtextstream.h>
28#include <qstringlist.h> 28#include <qstringlist.h>
29#include <qregexp.h> 29#include <qregexp.h>
30#include <qtextbrowser.h> 30#include <qtextbrowser.h>
31#include <stdlib.h> // for getenv
31 32
32DingWidget::DingWidget(QWidget *parent, QString word, QTextBrowser *browser_top, QTextBrowser *browser_bottom) : QWidget(parent) 33DingWidget::DingWidget(QWidget *parent, QString word, QTextBrowser *browser_top, QTextBrowser *browser_bottom) : QWidget(parent)
33{ 34{
34 QFile file( "/home/carsten/opie/opie/noncore/apps/odict/eng_ita.dic" ); 35 QString opie_dir = getenv("OPIEDIR");
36 QFile file( opie_dir+"/noncore/apps/odict/eng_ita.dic" );
35 QStringList lines; 37 QStringList lines;
36 38
37 if( file.open( IO_ReadOnly ) ) 39 if( file.open( IO_ReadOnly ) )
38 { 40 {
39 QTextStream stream( &file ); 41 QTextStream stream( &file );
40 while ( !stream.eof() ) 42 while ( !stream.eof() )
41 { 43 {
42 lines.append( stream.readLine() ); 44 lines.append( stream.readLine() );
43 } 45 }
44 file.close(); 46 file.close();
45 } 47 }
46 48
47 lines = lines.grep( word ); 49 lines = lines.grep( word );
48 50
49 //X for( QStringList::Iterator it = lines.begin() ; it != lines.end() ; ++it ) 51 //X for( QStringList::Iterator it = lines.begin() ; it != lines.end() ; ++it )
50 //X { 52 //X {
51 //X qDebug( *it ); 53 //X qDebug( *it );
52 //X } 54 //X }
53 QString top, bottom; 55 QString top, bottom;
54 56
55 parseInfo( lines, top , bottom ); 57 parseInfo( lines, top , bottom );
56 browser_top->setText( top ); 58 browser_top->setText( top );
57 browser_bottom->setText( bottom ); 59 browser_bottom->setText( bottom );
58} 60}
diff --git a/noncore/apps/odict/searchmethoddlg.cpp b/noncore/apps/odict/searchmethoddlg.cpp
index 203c663..8a14703 100644
--- a/noncore/apps/odict/searchmethoddlg.cpp
+++ b/noncore/apps/odict/searchmethoddlg.cpp
@@ -5,48 +5,49 @@
5 copyright : ( C ) 2002, 2003 by Carsten Niehaus 5 copyright : ( C ) 2002, 2003 by Carsten Niehaus
6 email : cniehaus@handhelds.org 6 email : cniehaus@handhelds.org
7 **************************************************************************/ 7 **************************************************************************/
8 8
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
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#include <qdir.h>
29 30
30#include <opie/ofileselector.h> 31#include <opie/ofileselector.h>
31#include <opie/ofiledialog.h> 32#include <opie/ofiledialog.h>
32 33
33SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal) 34SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal, QString itemname) : QDialog(parent, name, modal)
34{ 35{
35 36
36 QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" ); 37 QVBoxLayout *vbox_layout = new QVBoxLayout( this, 4,4,"vbox_layout" );
37 QVBox *vbox = new QVBox( this ); 38 QVBox *vbox = new QVBox( this );
38 39
39 QHBox *hbox1 = new QHBox( vbox ); 40 QHBox *hbox1 = new QHBox( vbox );
40 QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 ); 41 QLabel *nameLabel = new QLabel( tr( "Name:" ) , hbox1 );
41 nameLE = new QLineEdit( hbox1 ); 42 nameLE = new QLineEdit( hbox1 );
42 43
43 QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox ); 44 QLabel *dictLabel = new QLabel( tr( "Dictionary file" ), vbox );
44 QHBox *hbox2 = new QHBox( vbox ); 45 QHBox *hbox2 = new QHBox( vbox );
45 dictFileLE = new QLineEdit( hbox2 ); 46 dictFileLE = new QLineEdit( hbox2 );
46 QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 ); 47 QPushButton *browseButton = new QPushButton( tr( "Browse" ) , hbox2 );
47 connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) ); 48 connect( browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowse() ) );
48 49
49 QWidget *dummywidget = new QWidget( vbox ); 50 QWidget *dummywidget = new QWidget( vbox );
50 QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget); 51 QLabel *lag1 = new QLabel( tr( "Language 1" ),dummywidget);
51 QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget); 52 QLabel *devider = new QLabel( tr( "Decollator" ),dummywidget);
52 QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget); 53 QLabel *lag2 = new QLabel( tr( "Language 2" ),dummywidget);
@@ -69,39 +70,39 @@ SearchMethodDlg::SearchMethodDlg(QWidget *parent, const char *name, bool modal,
69 70
70 if( !itemname ) 71 if( !itemname )
71 setCaption( tr( "New Searchmethod" ) ); 72 setCaption( tr( "New Searchmethod" ) );
72 else 73 else
73 { 74 {
74 setCaption( tr( "Change Searchmethod" ) ); 75 setCaption( tr( "Change Searchmethod" ) );
75 itemName = itemname; 76 itemName = itemname;
76 setupEntries(itemname); 77 setupEntries(itemname);
77 } 78 }
78} 79}
79 80
80void SearchMethodDlg::setupEntries( QString item ) 81void SearchMethodDlg::setupEntries( QString item )
81{ 82{
82 Config cfg( "odict" ); 83 Config cfg( "odict" );
83 cfg.setGroup( "Method_"+itemName ); 84 cfg.setGroup( "Method_"+itemName );
84 trenner->setText( cfg.readEntry( "Seperator" ) ); 85 trenner->setText( cfg.readEntry( "Seperator" ) );
85 lang1->setText( cfg.readEntry( "Lang1" ) ); 86 lang1->setText( cfg.readEntry( "Lang1" ) );
86 lang2->setText( cfg.readEntry( "Lang2" ) ); 87 lang2->setText( cfg.readEntry( "Lang2" ) );
87 nameLE->setText( itemName ); 88 nameLE->setText( itemName );
88 dictFileLE->setText( cfg.readEntry( "file" ) ); 89 dictFileLE->setText( cfg.readEntry( "file" ) );
89} 90}
90 91
91void SearchMethodDlg::slotBrowse() 92void SearchMethodDlg::slotBrowse()
92{ 93{
93 itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,"/home/carsten" ); 94 itemName=OFileDialog::getOpenFileName( OFileSelector::EXTENDED,QDir::homeDirPath());
94 dictFileLE->setText( itemName ); 95 dictFileLE->setText( itemName );
95} 96}
96 97
97void SearchMethodDlg::saveItem() 98void SearchMethodDlg::saveItem()
98{ 99{
99 QString name = nameLE->text(); 100 QString name = nameLE->text();
100 Config cfg( "odict" ); 101 Config cfg( "odict" );
101 cfg.setGroup( "Method_"+name ); 102 cfg.setGroup( "Method_"+name );
102 cfg.writeEntry( "Name", name ); 103 cfg.writeEntry( "Name", name );
103 cfg.writeEntry( "Seperator", trenner->text() ); 104 cfg.writeEntry( "Seperator", trenner->text() );
104 cfg.writeEntry( "Lang1", lang1->text() ); 105 cfg.writeEntry( "Lang1", lang1->text() );
105 cfg.writeEntry( "Lang2", lang2->text() ); 106 cfg.writeEntry( "Lang2", lang2->text() );
106 cfg.writeEntry( "file", dictFileLE->text() ); 107 cfg.writeEntry( "file", dictFileLE->text() );
107} 108}