summaryrefslogtreecommitdiff
path: root/noncore/apps/odict/odict.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/odict/odict.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/odict/odict.cpp55
1 files changed, 42 insertions, 13 deletions
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp
index 6f176f9..549c40a 100644
--- a/noncore/apps/odict/odict.cpp
+++ b/noncore/apps/odict/odict.cpp
@@ -30,91 +30,120 @@
#include <qlineedit.h>
#include <qmainwindow.h>
#include <qstring.h>
#include <qaction.h>
#include <qtextbrowser.h>
#include <qcombobox.h>
#include <qpe/resource.h>
ODict::ODict() : QMainWindow()
{
-
activated_name = QString::null;
+
vbox = new QVBox( this );
setCaption( tr( "OPIE-Dictionary" ) );
setupMenus();
+
QHBox *hbox = new QHBox( vbox );
QLabel* query_label = new QLabel( tr( "Query:" ) , hbox ); query_label->show();
query_le = new QLineEdit( hbox );
query_co = new QComboBox( hbox );
connect( query_co , SIGNAL( activated(int) ), this, SLOT( slotMethodChanged(int) ) );
ok_button = new QPushButton( tr( "&Ok" ), hbox );
connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) );
browser_top = new QTextBrowser( vbox );
browser_bottom = new QTextBrowser( vbox );
+ ding = new DingWidget();
+
loadConfig();
setCentralWidget( vbox );
}
void ODict::loadConfig()
{
Config cfg ( "odict" );
cfg.setGroup( "generalsettings" );
errorTol = cfg.readEntry( "errtol" ).toInt();
casesens = cfg.readEntry( "casesens" ).toInt();
regexp = cfg.readEntry( "regexp" ).toInt();
completewords = cfg.readEntry( "completewords" ).toInt();
QStringList groupListCfg = cfg.groupList().grep( "Method_" );
query_co->clear();
for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it )
{
cfg.setGroup( *it );
query_co->insertItem( cfg.readEntry( "Name" ) );
}
+ slotMethodChanged(1 ); //FIXME: this line should not contain a integer
}
void ODict::saveConfig()
{
Config cfg ( "odict" );
cfg.setGroup( "generalsettings" );
cfg.writeEntry( "errtol" , errorTol );
cfg.writeEntry( "casesens" , casesens );
cfg.writeEntry( "regexp" , regexp );
cfg.writeEntry( "completewords" , completewords );
}
void ODict::slotDisplayAbout()
{
- QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030104" ) );
+ QMessageBox::about( this, tr( "About ODict" ), tr( "OPIE-Dictionary ODict \n (c) 2002, 2003 Carsten Niehaus \n cniehaus@handhelds.org \n Version 20030108" ) );
}
void ODict::slotStartQuery()
{
QString querystring = query_le->text();
- qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1());
- if (querystring.isEmpty()){
- qWarning("empty querystring");
- return;
- }
- if (!activated_name || activated_name.isEmpty())
- QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") );
- else
- DingWidget *ding = new DingWidget( querystring , browser_top, browser_bottom, activated_name );
- ding->setText();
+//X qDebug("opening dict >%s< for >%s<", activated_name.latin1(),querystring.latin1());
+//X if (querystring.isEmpty()){
+//X qWarning("empty querystring");
+//X return;
+//X }
+//X if (!activated_name || activated_name.isEmpty())
+//X QMessageBox::warning(this,tr("No Dictionary"),tr("Please choose a dictonary") );
+//X else
+//X {
+
+ ding->setCaseSensitive( casesens );
+ ding->setCompleteWord( completewords );
+ ding->setDict( activated_name );
+
+ qDebug( " activated_name ist :" );
+ qDebug( activated_name );
+
+ qDebug( " loadedDict() ist :" );
+ qDebug( ding->loadedDict() );
+ if ( activated_name != ding->loadedDict() )
+ {
+ qDebug( "ComboBox geändert" );
+ ding->loadDict(activated_name);
+ }
+ else qDebug( "ComboBox war GLEICH" );
+
+ BroswerContent test = ding->setText( querystring );
+
+ browser_top->setText( test.top );
+ browser_bottom->setText( test.bottom );
+
+ qDebug( "Text sollte gesetzt sein..." );
+
+//X }
+
}
void ODict::slotSetErrorcount( int count )
{
errorTol = count;
}
void ODict::slotSettings()
{
ConfigDlg dlg( this, "Config" , true);
if ( dlg.exec() == QDialog::Accepted )
@@ -143,25 +172,25 @@ void ODict::slotSetParameter( int count )
completewords = true;
}
if ( count == 2 )
{
if ( regexp )
regexp = false;
else
regexp = true;
}
else qWarning( "ERROR" );
}
-void ODict::slotMethodChanged( int methodnumber )
+void ODict::slotMethodChanged( int /*methodnumber*/ )
{
activated_name = query_co->currentText();
}
void ODict::setupMenus()
{
menu = new QMenuBar( this );
settings = new QPopupMenu( menu );
setting_a = new QAction(tr( "Config" ), Resource::loadPixmap( "today/config" ), QString::null, 0, this, 0 );
connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
setting_a->addTo( settings );