summaryrefslogtreecommitdiff
path: root/noncore/apps
authorkergoth <kergoth>2003-08-09 16:24:58 (UTC)
committer kergoth <kergoth>2003-08-09 16:24:58 (UTC)
commite16d333ec2e8509fc665921ca106c25325bae9e0 (patch) (side-by-side diff)
tree9e9068190a15bc9b2a52ab33b40881128f732c0e /noncore/apps
parent1c58d1407f9584fedcdae390a04e2b37e5853361 (diff)
downloadopie-e16d333ec2e8509fc665921ca106c25325bae9e0.zip
opie-e16d333ec2e8509fc665921ca106c25325bae9e0.tar.gz
opie-e16d333ec2e8509fc665921ca106c25325bae9e0.tar.bz2
Merge from BRANCH_1_0
Diffstat (limited to 'noncore/apps') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/odict/configdlg.cpp22
-rw-r--r--noncore/apps/odict/configdlg.h2
-rw-r--r--noncore/apps/odict/odict.cpp12
-rw-r--r--noncore/apps/odict/odict.h2
-rw-r--r--noncore/apps/odict/odict.pro2
-rw-r--r--noncore/apps/odict/opie-odict.control2
-rw-r--r--noncore/apps/tableviewer/db/xmlsource.cpp6
-rw-r--r--noncore/apps/tableviewer/tableviewer.pro2
-rw-r--r--noncore/apps/tableviewer/ui/tvbrowseview.cpp7
-rw-r--r--noncore/apps/tableviewer/xmlencodeattr.cpp48
-rw-r--r--noncore/apps/tableviewer/xmlencodeattr.h26
11 files changed, 94 insertions, 37 deletions
diff --git a/noncore/apps/odict/configdlg.cpp b/noncore/apps/odict/configdlg.cpp
index 400298d..2103df9 100644
--- a/noncore/apps/odict/configdlg.cpp
+++ b/noncore/apps/odict/configdlg.cpp
@@ -20,58 +20,48 @@
#include <qdialog.h>
#include <qpe/config.h>
#include <qlayout.h>
#include <qhbox.h>
#include <qvbox.h>
#include <qlabel.h>
#include <qlistview.h>
#include <qpushbutton.h>
#include <qlineedit.h>
#include <qstringlist.h>
-#include <opie/otabwidget.h>
-
ConfigDlg::ConfigDlg(QWidget *parent, const char *name, bool modal) : QDialog(parent, name, modal)
{
setCaption( tr( "Options" ) );
QVBoxLayout *vbox_layout = new QVBoxLayout( this );
- tab = new OTabWidget( this, "OTabWidget_tab", OTabWidget::Global, OTabWidget::Bottom );
- vbox_layout->addWidget( tab );
-
- /*general settings*/
- settings_tab = new QWidget( tab , "settings_tab" );
-
- /*searchmethods*/
- search_tab = new QWidget( tab , "search_tab" );
+ search_tab = new QWidget( this , "search_tab" );
QVBoxLayout *vbox_layout_searchtab = new QVBoxLayout( search_tab, 4 , 4 ,"blah" );
QHBox *hbox = new QHBox( search_tab );
list = new QListView( hbox );
list->addColumn( tr( "Searchmethod" ) );
loadSearchMethodNames();
QVBox *vbox = new QVBox( hbox );
- new_button = new QPushButton( "New" , vbox );
- change_button = new QPushButton( "Change" , vbox );
- delete_button = new QPushButton( "Delete" , vbox );
+ new_button = new QPushButton( tr( "New" ) , vbox );
+ change_button = new QPushButton( tr( "Change" ) , vbox );
+ delete_button = new QPushButton( tr( "Delete" ) , vbox );
connect( new_button, SIGNAL( clicked() ), this, SLOT( slotNewMethod() ) );
connect( change_button, SIGNAL( clicked() ), this, SLOT( slotChangeMethod() ));
connect( delete_button, SIGNAL( clicked() ), this, SLOT( slotDeleteMethod() ));
vbox_layout_searchtab->addWidget( hbox );
- /*add the tabs and maximize*/
- tab->addTab( settings_tab, "pass", tr( "General Settings" ) );
- tab->addTab( search_tab, "zoom", tr( "Searchmethods" ) );
+ vbox_layout->addWidget( search_tab );
+
showMaximized();
}
void ConfigDlg::slotNewMethod()
{
SearchMethodDlg dlg( this, "SearchMethodDlg", true );
if ( dlg.exec() == QDialog::Accepted )
{
dlg.saveItem();
QListViewItem *item = new QListViewItem( list );
item->setText( 0 , dlg.nameLE->text() );
}
diff --git a/noncore/apps/odict/configdlg.h b/noncore/apps/odict/configdlg.h
index e3ef3ce..6c85989 100644
--- a/noncore/apps/odict/configdlg.h
+++ b/noncore/apps/odict/configdlg.h
@@ -1,36 +1,34 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* ( at your option ) any later version. *
* *
**************************************************************************/
class QWidget;
-class OTabWidget;
class QListView;
class QPushButton;
#include <qdialog.h>
class ConfigDlg : public QDialog
{
Q_OBJECT
public:
ConfigDlg(QWidget *parent, const char *name, bool modal=FALSE );
private:
- OTabWidget *tab;
QWidget *settings_tab, *search_tab;
QListView *list;
QPushButton *new_button, *change_button, *delete_button;
void loadSearchMethodNames();
private slots:
void slotNewMethod();
void slotChangeMethod();
void slotDeleteMethod();
};
diff --git a/noncore/apps/odict/odict.cpp b/noncore/apps/odict/odict.cpp
index 2028701..010545e 100644
--- a/noncore/apps/odict/odict.cpp
+++ b/noncore/apps/odict/odict.cpp
@@ -32,25 +32,25 @@
#include <qaction.h>
#include <qtextbrowser.h>
#include <qcombobox.h>
#include <qpe/resource.h>
#include <qpe/config.h>
ODict::ODict() : QMainWindow()
{
activated_name = QString::null;
vbox = new QVBox( this );
- setCaption( tr( "OPIE-Dictionary" ) );
+ 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(const QString&) ), this, SLOT( slotMethodChanged(const QString&) ) );
ok_button = new QPushButton( tr( "&Ok" ), hbox );
connect( ok_button, SIGNAL( released() ), this, SLOT( slotStartQuery() ) );
top_name = new QLabel( vbox );
@@ -67,25 +67,24 @@ ODict::ODict() : QMainWindow()
}
void ODict::loadConfig()
{
/*
* the name of the last used dictionary
*/
QString lastname;
Config cfg ( "odict" );
cfg.setGroup( "generalsettings" );
casesens = cfg.readEntry( "casesens" ).toInt();
- regexp = cfg.readEntry( "regexp" ).toInt();
QString lastDict = cfg.readEntry( "lastdict" );
int i = 0, e = 0;
QStringList groupListCfg = cfg.groupList().grep( "Method_" );
query_co->clear();
for ( QStringList::Iterator it = groupListCfg.begin() ; it != groupListCfg.end() ; ++it )
{
QString name;
cfg.setGroup( *it );
name = cfg.readEntry( "Name" );
query_co->insertItem( name );
@@ -118,25 +117,24 @@ void ODict::lookupLanguageNames( QString dictname )
{
Config cfg ( "odict" );
cfg.setGroup( "Method_"+dictname );
top_name_content = cfg.readEntry( "Lang1" );
bottom_name_content = cfg.readEntry( "Lang2" );
}
void ODict::saveConfig()
{
Config cfg ( "odict" );
cfg.setGroup( "generalsettings" );
cfg.writeEntry( "casesens" , casesens );
- cfg.writeEntry( "regexp" , regexp );
cfg.writeEntry( "lastdict" , query_co->currentText() );
}
void ODict::slotStartQuery()
{
QString querystring = query_le->text();
if ( !querystring.isEmpty() )
{
/*
* if the user has not yet defined a dictionary
*/
if ( !query_co->currentText() )
@@ -176,31 +174,24 @@ void ODict::slotSettings()
}
void ODict::slotSetParameter( int count )
{
if ( count == 0 )
{
if ( casesens )
casesens = false;
else
casesens = true;
}
- if ( count == 1 )
- {
- if ( regexp )
- regexp = false;
- else
- regexp = true;
- }
saveConfig();
}
void ODict::slotMethodChanged( const QString& methodnumber )
{
activated_name = methodnumber;
if ( activated_name != ding->loadedDict() )
{
ding->loadDict(activated_name);
lookupLanguageNames( activated_name );
@@ -213,18 +204,17 @@ void ODict::setupMenus()
{
menu = new QMenuBar( this );
settings = new QPopupMenu( menu );
setting_a = new QAction(tr( "Configuration" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
connect( setting_a, SIGNAL( activated() ), this, SLOT( slotSettings() ) );
setting_a->addTo( settings );
setting_b = new QAction(tr( "Searchmethods" ), Resource::loadPixmap( "edit" ), QString::null, 0, this, 0 );
parameter = new QPopupMenu( menu );
connect( parameter, SIGNAL( activated( int ) ), this, SLOT( slotSetParameter( int ) ) );
parameter->insertItem( tr( "C&ase sensitive" ), 0 ,0 );
- parameter->insertItem( tr( "Allow &reg. expressions" ), 2 );
parameter->insertSeparator();
menu->insertItem( tr( "Settings" ) , settings );
menu->insertItem( tr( "Parameter" ) , parameter );
}
diff --git a/noncore/apps/odict/odict.h b/noncore/apps/odict/odict.h
index 9c037ea..be2a532 100644
--- a/noncore/apps/odict/odict.h
+++ b/noncore/apps/odict/odict.h
@@ -40,25 +40,25 @@ class ODict : public QMainWindow
QMenuBar *menu;
QHBox *hbox;
QLineEdit *query_le;
QComboBox *query_co;
QPushButton *ok_button;
QVBoxLayout *vbox_layout;
QAction *setting_a, *setting_b;
void setupMenus();
- bool casesens, completewords, regexp;
+ bool casesens, completewords;
void loadConfig();
void saveConfig();
QString activated_name;
QLabel *bottom_name,
*top_name;
QString top_name_content, bottom_name_content;
void lookupLanguageNames( QString );
diff --git a/noncore/apps/odict/odict.pro b/noncore/apps/odict/odict.pro
index 427a5c6..82f6a41 100644
--- a/noncore/apps/odict/odict.pro
+++ b/noncore/apps/odict/odict.pro
@@ -1,19 +1,19 @@
TEMPLATE = app
CONFIG = qt warn_on debug
#CONFIG = qt warn_on release
HEADERS = odict.h \
searchmethoddlg.h \
configdlg.h \
- dingwidget.h \
+ dingwidget.h
SOURCES = main.cpp \
odict.cpp \
searchmethoddlg.cpp \
configdlg.cpp \
dingwidget.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lstdc++ -lopie
TARGET = odict
DESTDIR = $(OPIEDIR)/bin
diff --git a/noncore/apps/odict/opie-odict.control b/noncore/apps/odict/opie-odict.control
index 2fa731f..f684716 100644
--- a/noncore/apps/odict/opie-odict.control
+++ b/noncore/apps/odict/opie-odict.control
@@ -1,10 +1,10 @@
Package: opie-odict
Files: bin/odict apps/Applications/odict.desktop pics/odict/odict.png
Priority: optional
Section: applications
Maintainer: Carsten Niehaus <cniehaus@handhelds.org>
Architecture: arm
-Version: $QPE_VERSION-$SUB_VERSION
Depends: task-opie-minimal
Description: Dictionarylookupprogram
Look up words :)
+Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/apps/tableviewer/db/xmlsource.cpp b/noncore/apps/tableviewer/db/xmlsource.cpp
index 7418a85..94fec36 100644
--- a/noncore/apps/tableviewer/db/xmlsource.cpp
+++ b/noncore/apps/tableviewer/db/xmlsource.cpp
@@ -12,24 +12,26 @@
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "xmlsource.h"
#include <qdict.h>
#include <stdlib.h>
#include <qtextstream.h>
+#include "../xmlencodeattr.h"
+
DBXml::DBXml(DBStore *d)
{
dstore = d;
}
QString DBXml::type()
{
return "xml";
}
@@ -59,25 +61,25 @@ bool DBXml::saveSource(QIODevice *outDev)
outstream << "<database name=\"" << dstore->getName() << "\">" << endl;
outstream << "<header>" << endl;
k = dstore->getKeys();
KeyListIterator it(*k);
while(it.current()) {
if (!it.current()->delFlag()) {
outstream << "<key name=\"KEYID" << it.currentKey() << "\" ";
outstream << "type=\""
<< TVVariant::typeToName(it.current()->type())
<< "\">";
- outstream << it.current()->name() << "</key>" << endl;
+ outstream << encodeAttr(it.current()->name()) << "</key>" << endl;
}
++it;
}
outstream << "</header>" << endl;
dstore->first();
do {
elem = dstore->getCurrentData();
if (!elem)
break;
@@ -85,25 +87,25 @@ bool DBXml::saveSource(QIODevice *outDev)
it.toFirst();
while (it.current()) {
i = it.currentKey();
if (elem->hasValidValue(i)) {
outstream << "<KEYID" << i << ">";
if (dstore->getKeyType(i) == TVVariant::Date) {
// dates in files are different from displayed dates
QDate date = elem->getField(i).toDate();
outstream << date.day() << "/"
<< date.month() << "/"
<< date.year();
} else {
- outstream << elem->toQString(i);
+ outstream << encodeAttr(elem->toQString(i));
}
outstream << "</KEYID" << i << ">" << endl;
}
++it;
}
outstream << "</record>" << endl;
} while(dstore->next());
outstream << "</database>" << endl;
return TRUE;
}
diff --git a/noncore/apps/tableviewer/tableviewer.pro b/noncore/apps/tableviewer/tableviewer.pro
index 6f73400..f047e0b 100644
--- a/noncore/apps/tableviewer/tableviewer.pro
+++ b/noncore/apps/tableviewer/tableviewer.pro
@@ -1,31 +1,33 @@
TEMPLATE = app
CONFIG = qt warn_on debug
DESTDIR = $(OPIEDIR)/bin
SUBDIRS = db ui
HEADERS = tableviewer.h \
+ xmlencodeattr.h \
ui/commonwidgets.h \
ui/tvbrowseview.h \
ui/tvlistview.h \
ui/tvfilterview.h \
ui/tveditview.h \
ui/browsekeyentry.h \
ui/filterkeyentry.h \
ui/tvkeyedit.h \
db/datacache.h \
db/common.h \
db/xmlsource.h \
db/csvsource.h
SOURCES = main.cpp \
tableviewer.cpp \
+ xmlencodeattr.cpp \
ui/commonwidgets.cpp \
ui/tvbrowseview.cpp \
ui/tvfilterview.cpp \
ui/browsekeyentry.cpp \
ui/filterkeyentry.cpp \
ui/tvlistview.cpp \
ui/tveditview.cpp \
ui/tvkeyedit.cpp \
db/datacache.cpp \
db/xmlsource.cpp \
db/csvsource.cpp \
db/common.cpp
diff --git a/noncore/apps/tableviewer/ui/tvbrowseview.cpp b/noncore/apps/tableviewer/ui/tvbrowseview.cpp
index f5f2555..22bac55 100644
--- a/noncore/apps/tableviewer/ui/tvbrowseview.cpp
+++ b/noncore/apps/tableviewer/ui/tvbrowseview.cpp
@@ -14,24 +14,25 @@
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "tvbrowseview.h"
#include "browsekeyentry.h"
#include <qtoolbutton.h>
#include <qtextview.h>
#include <qtextbrowser.h>
#include <qlayout.h>
+#include "../xmlencodeattr.h"
/*!
\class TVBrowseView
\brief The widget describing how to draw the browse view user interface
This widget allows for the user to browse through the table, one element
at a time, or search on a single key. Its main goal is to show a
single element in a readable format and make it easy for the user to
rapidly find specific elements in the table.
*/
/*!
@@ -93,30 +94,30 @@ void TVBrowseView::reset()
sets the data element to be displayed to element
*/
void TVBrowseView::setDisplayText(const DataElem *element)
{
QString rep = "";
KeyListIterator it(*ts->kRep);
while (it.current()) {
if (element->hasValidValue(it.currentKey())) {
if(it.currentKey() == ts->current_column) {
rep += "<A name=\"ckey\"></A><B><FONT COLOR=#FF0000>"
- + it.current()->name()
+ + encodeAttr(it.current()->name())
+ ":</FONT></B> ";
} else {
- rep += "<B>" + it.current()->name() + ":</B> ";
+ rep += "<B>" + encodeAttr(it.current()->name()) + ":</B> ";
}
- rep += element->toQString(it.currentKey()) + "<BR>";
+ rep += encodeAttr(element->toQString(it.currentKey())) + "<BR>";
}
++it;
}
textViewDisplay->setText(rep);
textViewDisplay->scrollToAnchor("ckey");
}
void TVBrowseView::rebuildKeys()
{
keyEntry->rebuildKeys();
}
diff --git a/noncore/apps/tableviewer/xmlencodeattr.cpp b/noncore/apps/tableviewer/xmlencodeattr.cpp
new file mode 100644
index 0000000..de264f7
--- a/dev/null
+++ b/noncore/apps/tableviewer/xmlencodeattr.cpp
@@ -0,0 +1,48 @@
+/*
+ * xmlencodeattr.h
+ *
+ * copyright : (c) 2003 by Joseph Wenninger
+ * except for a small modification it's identical to qdom.cpp:encodeAttr
+ * email : jowenn@handhelds.org
+ *
+ */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "xmlencodeattr.h"
+QString encodeAttr( const QString& str )
+{
+ QString tmp( str );
+ uint len = tmp.length();
+ uint i = 0;
+ while ( i < len ) {
+ if ( tmp[(int)i] == '<' ) {
+ tmp.replace( i, 1, "&lt;" );
+ len += 3;
+ i += 4;
+ } else if ( tmp[(int)i] == '"' ) {
+ tmp.replace( i, 1, "&quot;" );
+ len += 5;
+ i += 6;
+ } else if ( tmp[(int)i] == '&' ) {
+ tmp.replace( i, 1, "&amp;" );
+ len += 4;
+ i += 5;
+ } else if ( tmp[(int)i] == '>' ) {
+ tmp.replace( i, 1, "&gt;" );
+ len += 3;
+ i += 4;
+ } else {
+ ++i;
+ }
+ }
+
+ return tmp;
+}
+
diff --git a/noncore/apps/tableviewer/xmlencodeattr.h b/noncore/apps/tableviewer/xmlencodeattr.h
new file mode 100644
index 0000000..5fd3b95
--- a/dev/null
+++ b/noncore/apps/tableviewer/xmlencodeattr.h
@@ -0,0 +1,26 @@
+/*
+ * xmlencodeattr.h
+ *
+ * copyright : (c) 2003 by Joseph Wenninger
+ * except for a small modification it's identical to qdom.cpp:encodeAttr
+ * email : jowenn@handhelds.org
+ *
+ */
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _XML_ENCODE_ATTR_
+#define _XML_ENCODE_ATTR_
+
+#include <qstring.h>
+
+QString encodeAttr( const QString& str );
+
+#endif
+