summaryrefslogtreecommitdiff
path: root/noncore/apps/tableviewer/ui
Side-by-side diff
Diffstat (limited to 'noncore/apps/tableviewer/ui') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tableviewer/ui/browsekeyentry.cpp49
-rw-r--r--noncore/apps/tableviewer/ui/filterkeyentry.cpp42
-rw-r--r--noncore/apps/tableviewer/ui/tvfilterview.cpp55
3 files changed, 77 insertions, 69 deletions
diff --git a/noncore/apps/tableviewer/ui/browsekeyentry.cpp b/noncore/apps/tableviewer/ui/browsekeyentry.cpp
index 42e24dd..6b78437 100644
--- a/noncore/apps/tableviewer/ui/browsekeyentry.cpp
+++ b/noncore/apps/tableviewer/ui/browsekeyentry.cpp
@@ -13,39 +13,39 @@
**
** 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 "browsekeyentry.h"
#include "commonwidgets.h"
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
#include <qtoolbutton.h>
#include <qwidgetstack.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qpopupmenu.h>
#include <qhbox.h>
#include <qdatetime.h>
-#include <qheader.h>
-// For qWarning(const char *)
-
/*!
\class TVBrowseKeyEntry
\brief a Widget used enter keys into the TVBrowseViewWidget
The TVBrowseKeyEntry Widget provides the facility to enter
various key types to be search on in the table. The key can be changed
and the entry field will update to the correct sort of widget appropriately
*/
/*!
- Constructs the widget
+ Constructs the widget
*/
TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
: QWidget(parent, name, f)
{
QHBoxLayout *h_layout = new QHBoxLayout(this);
@@ -70,42 +70,42 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
ws->addWidget(textKey, TVVariant::String);
ws->addWidget(intKey, TVVariant::Int);
ws->addWidget(timeKey, TVVariant::Time);
ws->addWidget(dateKey, TVVariant::Date);
ws->raiseWidget(TVVariant::String);
-
+
// TODO connect slots and signals....
- connect(changeKeyButton, SIGNAL(clicked()),
+ connect(changeKeyButton, SIGNAL(clicked()),
this, SLOT(changeKeyMenuSlot()));
- connect(resetButton, SIGNAL(clicked()),
+ connect(resetButton, SIGNAL(clicked()),
textKey, SLOT(clear()));
- connect(resetButton, SIGNAL(clicked()),
+ connect(resetButton, SIGNAL(clicked()),
intKey, SLOT(clear()));
- connect(resetButton, SIGNAL(clicked()),
+ connect(resetButton, SIGNAL(clicked()),
dateKey, SLOT(clear()));
- connect(resetButton, SIGNAL(clicked()),
+ connect(resetButton, SIGNAL(clicked()),
timeKey, SLOT(clear()));
h_layout->addWidget(ws);
h_layout->addWidget(resetButton);
h_layout->addWidget(changeKeyButton);
- connect(textKey, SIGNAL(textChanged(const QString&)),
+ connect(textKey, SIGNAL(textChanged(const QString&)),
this, SLOT(searchOnText()));
- connect(intKey, SIGNAL(valueChanged(int)),
+ connect(intKey, SIGNAL(valueChanged(int)),
this, SLOT(searchOnText()));
- connect(dateKey, SIGNAL(valueChanged(const QDate&)),
+ connect(dateKey, SIGNAL(valueChanged(const QDate&)),
this, SLOT(searchOnText()));
- connect(timeKey, SIGNAL(valueChanged(const QTime&)),
+ connect(timeKey, SIGNAL(valueChanged(const QTime&)),
this, SLOT(searchOnText()));
}
/*!
- Destructs the widget
+ Destructs the widget
*/
TVBrowseKeyEntry::~TVBrowseKeyEntry()
{
}
/*!
@@ -123,13 +123,13 @@ void TVBrowseKeyEntry::changeKeySlot(int id_param)
/*!
Opens the change key menu
*/
void TVBrowseKeyEntry::changeKeyMenuSlot()
{
- if(ts)
+ if(ts)
keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0)));
}
void TVBrowseKeyEntry::setTableState(TableState *t) {
ts = t;
@@ -143,13 +143,13 @@ void TVBrowseKeyEntry::rebuildKeys() {
/* clear the old */
keyMenu->clear();
KeyListIterator it(*ts->kRep);
for (i = 0; i < ts->kRep->getNumFields(); i++) {
- keyMenu->insertItem(it.current()->name(), this,
+ keyMenu->insertItem(it.current()->name(), this,
SLOT(changeKeySlot(int)), 0, i);
keyMenu->setItemParameter(i, it.currentKey());
++it;
}
}
@@ -160,14 +160,14 @@ void TVBrowseKeyEntry::reset()
dateKey->clear();
timeKey->clear();
keyMenu->clear();
}
/*!
- Searches on the current value of the key entry provided that the
- current key is of type text WARNING, TODO fix memory leaks
+ Searches on the current value of the key entry provided that the
+ current key is of type text WARNING, TODO fix memory leaks
*/
void TVBrowseKeyEntry::searchOnText()
{
TVVariant sendkey;
if (!ts)
@@ -186,21 +186,20 @@ void TVBrowseKeyEntry::searchOnText()
break;
}
case TVVariant::Date: {
sendkey = TVVariant(QDate(dateKey->date()));
break;
}
- case TVVariant::Invalid:
- break;
+ case TVVariant::Invalid:
+ break;
default:
- qWarning("TVBrowseKeyEntry::searchOnText() "
- "cannot work out data type");
+ owarn << "TVBrowseKeyEntry::searchOnText() cannot work out data type" << oendl;
return;
}
emit searchOnKey(ts->current_column, sendkey);
}
/*! \fn void TVBrowseKeyEntry::searchOnKey(int currentKeyId, TVVariant)
This signal indicates that a search on key index currentKeyId should be
done searching for the value v.
-*/
+*/
diff --git a/noncore/apps/tableviewer/ui/filterkeyentry.cpp b/noncore/apps/tableviewer/ui/filterkeyentry.cpp
index d108fbd..4d74d6b 100644
--- a/noncore/apps/tableviewer/ui/filterkeyentry.cpp
+++ b/noncore/apps/tableviewer/ui/filterkeyentry.cpp
@@ -13,16 +13,21 @@
**
** 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 "filterkeyentry.h"
#include "commonwidgets.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qwidgetstack.h>
#include <qcombobox.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qsizepolicy.h>
#include <qdatetime.h>
@@ -95,19 +100,19 @@ TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f)
ws->addWidget(textEntry, TVVariant::String);
ws->addWidget(intEntry, TVVariant::Int);
ws->addWidget(timeEntry, TVVariant::Time);
ws->addWidget(dateEntry, TVVariant::Date);
/* connect the signals down */
- connect(textKey, SIGNAL(textChanged(const QString&)),
+ connect(textKey, SIGNAL(textChanged(const QString&)),
this, SIGNAL(valueChanged()));
- connect(intKey, SIGNAL(valueChanged(int)),
+ connect(intKey, SIGNAL(valueChanged(int)),
this, SIGNAL(valueChanged()));
- connect(dateKey, SIGNAL(valueChanged(const QDate&)),
+ connect(dateKey, SIGNAL(valueChanged(const QDate&)),
this, SIGNAL(valueChanged()));
- connect(timeKey, SIGNAL(valueChanged(const QTime&)),
+ connect(timeKey, SIGNAL(valueChanged(const QTime&)),
this, SIGNAL(valueChanged()));
connect(intCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
connect(textCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
connect(timeCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
connect(dateCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
@@ -116,19 +121,19 @@ TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f)
layout->addWidget(ws);
current_type = TVVariant::String;
}
/*!
- Destructs the widget
+ Destructs the widget
*/
TVFilterKeyEntry::~TVFilterKeyEntry()
{
}
-void TVFilterKeyEntry::setKey(int i)
+void TVFilterKeyEntry::setKey(int i)
{
if (!ts) return;
if (!ts->kRep) return;
/* set up to raise appropriate widget set */
@@ -180,29 +185,28 @@ CmpType TVFilterKeyEntry::getCompareType()
TVVariant TVFilterKeyEntry::getCompareValue()
{
TVVariant sendkey;
int tmp;
switch(current_type) {
- case TVVariant::String:
- sendkey = TVVariant(QString(textKey->text()));
- break;
- case TVVariant::Int: {
+ case TVVariant::String:
+ sendkey = TVVariant(QString(textKey->text()));
+ break;
+ case TVVariant::Int: {
sendkey = TVVariant(intKey->value());
- break;
- }
+ break;
+ }
case TVVariant::Time: {
- sendkey = TVVariant(QTime(timeKey->time()));
- break;
+ sendkey = TVVariant(QTime(timeKey->time()));
+ break;
}
case TVVariant::Date: {
- sendkey = TVVariant(QDate(dateKey->date()));
- break;
+ sendkey = TVVariant(QDate(dateKey->date()));
+ break;
}
default: {
sendkey = TVVariant(0);
- qWarning("TVFilterKeyEntry::getCompareValue() "
- "cannot work out data type");
+ owarn << "TVFilterKeyEntry::getCompareValue() cannot work out data type" << oendl;
}
}
return sendkey;
}
diff --git a/noncore/apps/tableviewer/ui/tvfilterview.cpp b/noncore/apps/tableviewer/ui/tvfilterview.cpp
index 22f1fb7..198c8b5 100644
--- a/noncore/apps/tableviewer/ui/tvfilterview.cpp
+++ b/noncore/apps/tableviewer/ui/tvfilterview.cpp
@@ -15,27 +15,33 @@
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "tvfilterview.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+#include <qpe/qpeapplication.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qtoolbutton.h>
#include <qcombobox.h>
#include <qlistview.h>
#include <qlayout.h>
#include <qheader.h>
#include <qpushbutton.h>
#include <qlabel.h>
-#include <qpe/qpeapplication.h>
TVFilterView::TVFilterView(TableState *t, QWidget* parent,
const char *name, WFlags fl ) : QDialog(parent, name, TRUE, fl)
{
- if ( !name )
- setName( "Filter View" );
+ if ( !name )
+ setName( "Filter View" );
QVBoxLayout *vlayout = new QVBoxLayout(this);
display = new QListView(this, "display");
display->addColumn("Key");
display->addColumn("Constraint");
@@ -85,27 +91,27 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent,
connect(deleteFilterButton, SIGNAL( clicked() ), this, SLOT( deleteTerm()));
connect(clearFilterButton, SIGNAL( clicked() ), this, SLOT( clearTerms()));
connect(keyEntry, SIGNAL(valueChanged()), this, SLOT( updateTerm() ));
connect(keyNameCombo, SIGNAL(activated(int)), this, SLOT( updateTerm() ));
- connect(display, SIGNAL(selectionChanged(QListViewItem*)), this,
- SLOT(setTerm(QListViewItem*)));
+ connect(display, SIGNAL(selectionChanged(QListViewItem*)), this,
+ SLOT(setTerm(QListViewItem*)));
ts = t;
current = 0;
terms.setAutoDelete(true);
do_filter = false;
#ifdef Q_WS_QWS
QPEApplication::showDialog( this );
#endif
}
/*!
- Destroys the TVFilterView widget
+ Destroys the TVFilterView widget
*/
TVFilterView::~TVFilterView()
{
}
void TVFilterView::rebuildData()
@@ -115,41 +121,41 @@ void TVFilterView::rebuildData()
void TVFilterView::reset()
{
keyNameCombo->clear();
keyIds.clear();
}
-void TVFilterView::rebuildKeys()
+void TVFilterView::rebuildKeys()
{
int i;
if (!ts) return;
if(!ts->kRep) return;
keyEntry->setTableState(ts);
-
+
/* set up the list of keys that can be compared on */
keyNameCombo->clear();
KeyListIterator it(*ts->kRep);
i = 0;
while(it.current()) {
- if(ts->kRep->validIndex(it.currentKey())) {
- keyNameCombo->insertItem(it.current()->name());
- keyIds.insert(i, it.currentKey());
- ++i;
- }
- ++it;
+ if(ts->kRep->validIndex(it.currentKey())) {
+ keyNameCombo->insertItem(it.current()->name());
+ keyIds.insert(i, it.currentKey());
+ ++i;
+ }
+ ++it;
}
}
bool TVFilterView::passesFilter(DataElem *d) {
if (!filterActive()) return true;
FilterTerm *t;
-
+
for (t = terms.first(); t != 0; t = terms.next() ) {
/* check against filter */
switch(t->ct) {
case ct_less:
if (!d->lessThan(t->keyIndex, t->value))
return false;
@@ -172,14 +178,13 @@ bool TVFilterView::passesFilter(DataElem *d) {
break;
case ct_endswith:
if (!d->endsWith(t->keyIndex, t->value))
return false;
break;
default:
- qWarning("TVFilterView::passesFilter() "
- "unrecognized filter type");
+ owarn << "TVFilterView::passesFilter() unrecognized filter type" << oendl;
return false;
}
}
return true;
}
@@ -191,13 +196,13 @@ bool TVFilterView::filterActive() const
if (terms.isEmpty())
return false;
return true;
}
/* SLOTS */
-void TVFilterView::newTerm()
+void TVFilterView::newTerm()
{
if (!ts) return;
FilterTerm *term = new FilterTerm;
current = term;
@@ -209,13 +214,13 @@ void TVFilterView::newTerm()
terms.append(term);
keyEntry->setEnabled(true);
keyNameCombo->setEnabled(true);
}
-void TVFilterView::updateTerm()
+void TVFilterView::updateTerm()
{
FilterTerm *term;
/* Read the widget values (keyname, compare type, value)
* and build the lists */
if (!ts) return;
if (!current) return;
@@ -228,13 +233,13 @@ void TVFilterView::updateTerm()
/* create new list item, set initial values, enable widgets */
term->keyIndex = keyIds[keyNameCombo->currentItem()];
keyEntry->setKey(term->keyIndex); /* so the next two items make sense */
term->ct = keyEntry->getCompareType(),
term->value = keyEntry->getCompareValue();
-
+
keyString = keyNameCombo->currentText();
switch(term->ct) {
case ct_less:
cmpString = " less than ";
break;
@@ -257,20 +262,20 @@ void TVFilterView::updateTerm()
cmpString = " ERROR ";
}
vString = term->value.toString();
/* remove old view */
- if (term->view)
+ if (term->view)
delete(term->view);
term->view = new QListViewItem(display, 0, keyString, cmpString, vString);
display->setSelected(term->view, true);
}
/* deletes current term */
-void TVFilterView::deleteTerm()
+void TVFilterView::deleteTerm()
{
if(!current) return;
if (current->view)
delete(current->view);
terms.removeRef(current);
@@ -281,26 +286,26 @@ void TVFilterView::deleteTerm()
keyEntry->setEnabled(false);
keyNameCombo->setEnabled(false);
}
}
/* clears all terminations */
-void TVFilterView::clearTerms()
+void TVFilterView::clearTerms()
{
while(current)
deleteTerm();
}
void TVFilterView::setTerm(QListViewItem *target)
{
- /* Iterate through the list to find item with view=target..
+ /* Iterate through the list to find item with view=target..
* set as current, delete */
FilterTerm *term = current;
for (current = terms.first(); current != 0; current = terms.next() )
if (current->view == target)
break;
if (!current) {
- current = term;
+ current = term;
}
}