author | simon <simon> | 2002-04-30 14:33:42 (UTC) |
---|---|---|
committer | simon <simon> | 2002-04-30 14:33:42 (UTC) |
commit | 85b6723c707949f5689bfca6f442d9cbb73f2ee9 (patch) (unidiff) | |
tree | 20afdd73f737c35560eff022a61f9b1f3c6497e1 | |
parent | b7b0040f0a8069d36e3f5ad0bed0ce992dd30780 (diff) | |
download | opie-85b6723c707949f5689bfca6f442d9cbb73f2ee9.zip opie-85b6723c707949f5689bfca6f442d9cbb73f2ee9.tar.gz opie-85b6723c707949f5689bfca6f442d9cbb73f2ee9.tar.bz2 |
- no default args in method impls
- don't return void in non-void functions
-rw-r--r-- | noncore/apps/tableviewer/db/common.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/tableviewer/db/csvsource.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/tableviewer/ui/commonwidgets.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/tableviewer/ui/tvbrowseview.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/tableviewer/ui/tveditview.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/tableviewer/ui/tvfilterview.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/tableviewer/ui/tvkeyedit.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/tableviewer/ui/tvlistview.cpp | 4 |
8 files changed, 15 insertions, 14 deletions
diff --git a/noncore/apps/tableviewer/db/common.cpp b/noncore/apps/tableviewer/db/common.cpp index 71844a5..dbf9370 100644 --- a/noncore/apps/tableviewer/db/common.cpp +++ b/noncore/apps/tableviewer/db/common.cpp | |||
@@ -634,97 +634,97 @@ bool TVVariant::closer(TVVariant n, TVVariant o) | |||
634 | break; | 634 | break; |
635 | } | 635 | } |
636 | return FALSE; | 636 | return FALSE; |
637 | } | 637 | } |
638 | 638 | ||
639 | /*! True if n is close to this */ | 639 | /*! True if n is close to this */ |
640 | bool TVVariant::close(TVVariant n) | 640 | bool TVVariant::close(TVVariant n) |
641 | { | 641 | { |
642 | /* Nothing is close to an invalid, so nothing can be closer */ | 642 | /* Nothing is close to an invalid, so nothing can be closer */ |
643 | if(type() == Invalid) | 643 | if(type() == Invalid) |
644 | return FALSE; | 644 | return FALSE; |
645 | 645 | ||
646 | /* can't be close if of different type */ | 646 | /* can't be close if of different type */ |
647 | if(n.type() != type()) | 647 | if(n.type() != type()) |
648 | return FALSE; | 648 | return FALSE; |
649 | 649 | ||
650 | switch(type()){ | 650 | switch(type()){ |
651 | case String: { | 651 | case String: { |
652 | /* case for strings is close is a substring.. closer is | 652 | /* case for strings is close is a substring.. closer is |
653 | * earlier alphabetically */ | 653 | * earlier alphabetically */ |
654 | QString qs1 = n.toString().lower(); | 654 | QString qs1 = n.toString().lower(); |
655 | QString qsv = toString().lower(); | 655 | QString qsv = toString().lower(); |
656 | 656 | ||
657 | if (!qs1.startsWith(qsv)) | 657 | if (!qs1.startsWith(qsv)) |
658 | return FALSE; | 658 | return FALSE; |
659 | return TRUE; | 659 | return TRUE; |
660 | } | 660 | } |
661 | case Int: | 661 | case Int: |
662 | case Date: | 662 | case Date: |
663 | case Time: | 663 | case Time: |
664 | return TRUE; | 664 | return TRUE; |
665 | default: | 665 | default: |
666 | /* don't know how to do 'closer' on this type, hence never closer | 666 | /* don't know how to do 'closer' on this type, hence never closer |
667 | * or even close */ | 667 | * or even close */ |
668 | break; | 668 | break; |
669 | } | 669 | } |
670 | return FALSE; | 670 | return FALSE; |
671 | } | 671 | } |
672 | 672 | ||
673 | /*! | 673 | /*! |
674 | \class Key | 674 | \class Key |
675 | \brief document me! | 675 | \brief document me! |
676 | 676 | ||
677 | document me! | 677 | document me! |
678 | */ | 678 | */ |
679 | 679 | ||
680 | Key::Key() : kname(), kexample(), kflags(0) { } | 680 | Key::Key() : kname(), kexample(), kflags(0) { } |
681 | 681 | ||
682 | Key::Key(QString name, TVVariant example, int flags = 0) : | 682 | Key::Key(QString name, TVVariant example, int flags) : |
683 | kname(name), kexample(example), kflags(flags) { } | 683 | kname(name), kexample(example), kflags(flags) { } |
684 | 684 | ||
685 | Key::Key(const Key &other) | 685 | Key::Key(const Key &other) |
686 | { | 686 | { |
687 | kname = other.kname; | 687 | kname = other.kname; |
688 | kexample = other.kexample; | 688 | kexample = other.kexample; |
689 | kflags = other.kflags; | 689 | kflags = other.kflags; |
690 | } | 690 | } |
691 | 691 | ||
692 | Key& Key::operator=(const Key& key) | 692 | Key& Key::operator=(const Key& key) |
693 | { | 693 | { |
694 | kname = key.kname; | 694 | kname = key.kname; |
695 | kexample = key.kexample; | 695 | kexample = key.kexample; |
696 | kflags = key.kflags; | 696 | kflags = key.kflags; |
697 | return *this; | 697 | return *this; |
698 | } | 698 | } |
699 | 699 | ||
700 | QString Key::name() const | 700 | QString Key::name() const |
701 | { | 701 | { |
702 | return QString(kname); | 702 | return QString(kname); |
703 | } | 703 | } |
704 | 704 | ||
705 | TVVariant Key::example() const | 705 | TVVariant Key::example() const |
706 | { | 706 | { |
707 | return TVVariant(kexample); | 707 | return TVVariant(kexample); |
708 | } | 708 | } |
709 | 709 | ||
710 | TVVariant::KeyType Key::type() const | 710 | TVVariant::KeyType Key::type() const |
711 | { | 711 | { |
712 | return kexample.type(); | 712 | return kexample.type(); |
713 | } | 713 | } |
714 | 714 | ||
715 | void Key::setName(const QString &name) | 715 | void Key::setName(const QString &name) |
716 | { | 716 | { |
717 | kname = QString(name); | 717 | kname = QString(name); |
718 | } | 718 | } |
719 | 719 | ||
720 | void Key::setExample(const TVVariant &e) | 720 | void Key::setExample(const TVVariant &e) |
721 | { | 721 | { |
722 | kexample = TVVariant(e); | 722 | kexample = TVVariant(e); |
723 | } | 723 | } |
724 | 724 | ||
725 | int Key::flags() const | 725 | int Key::flags() const |
726 | { | 726 | { |
727 | return kflags; | 727 | return kflags; |
728 | } | 728 | } |
729 | 729 | ||
730 | void Key::setFlags(int fl) | 730 | void Key::setFlags(int fl) |
diff --git a/noncore/apps/tableviewer/db/csvsource.cpp b/noncore/apps/tableviewer/db/csvsource.cpp index 2561b4b..ea36300 100644 --- a/noncore/apps/tableviewer/db/csvsource.cpp +++ b/noncore/apps/tableviewer/db/csvsource.cpp | |||
@@ -53,96 +53,97 @@ QStringList readElem(QString in) | |||
53 | if(firstChar) { | 53 | if(firstChar) { |
54 | /* skip whitespace */ | 54 | /* skip whitespace */ |
55 | while(index < in.length() && in[index] == ' ') | 55 | while(index < in.length() && in[index] == ' ') |
56 | index++; | 56 | index++; |
57 | if(in[index] == '"') { | 57 | if(in[index] == '"') { |
58 | quotedElem = TRUE; | 58 | quotedElem = TRUE; |
59 | index++; | 59 | index++; |
60 | } | 60 | } |
61 | } | 61 | } |
62 | /* real first char */ | 62 | /* real first char */ |
63 | QString elem; | 63 | QString elem; |
64 | if(quotedElem) { | 64 | if(quotedElem) { |
65 | while(index < in.length() && in[index] != '"') { | 65 | while(index < in.length() && in[index] != '"') { |
66 | /* check for escape character */ | 66 | /* check for escape character */ |
67 | if (in[index] == '\\') { | 67 | if (in[index] == '\\') { |
68 | if (index++ < in.length()) { | 68 | if (index++ < in.length()) { |
69 | elem.append(in[index]); | 69 | elem.append(in[index]); |
70 | index++; | 70 | index++; |
71 | } | 71 | } |
72 | } else { | 72 | } else { |
73 | elem.append(in[index]); | 73 | elem.append(in[index]); |
74 | index++; | 74 | index++; |
75 | } | 75 | } |
76 | } | 76 | } |
77 | } else { | 77 | } else { |
78 | while(index < in.length() && in[index] != ',') { | 78 | while(index < in.length() && in[index] != ',') { |
79 | if (in[index] == '\\') { | 79 | if (in[index] == '\\') { |
80 | if (index++ < in.length()) { | 80 | if (index++ < in.length()) { |
81 | elem.append(in[index]); | 81 | elem.append(in[index]); |
82 | index++; | 82 | index++; |
83 | } | 83 | } |
84 | } else { | 84 | } else { |
85 | elem.append(in[index]); | 85 | elem.append(in[index]); |
86 | index++; | 86 | index++; |
87 | } | 87 | } |
88 | } | 88 | } |
89 | } | 89 | } |
90 | /* we have our current elem */ | 90 | /* we have our current elem */ |
91 | out << elem.stripWhiteSpace(); | 91 | out << elem.stripWhiteSpace(); |
92 | firstChar = TRUE; | 92 | firstChar = TRUE; |
93 | quotedElem = FALSE; | 93 | quotedElem = FALSE; |
94 | /* skip till a , or end of line */ | 94 | /* skip till a , or end of line */ |
95 | while (index < in.length() && in[index] != ',') index++; | 95 | while (index < in.length() && in[index] != ',') index++; |
96 | if(index == in.length()) | 96 | if(index == in.length()) |
97 | return out; | 97 | return out; |
98 | else | 98 | else |
99 | index++; | 99 | index++; |
100 | } | 100 | } |
101 | return out; | ||
101 | } | 102 | } |
102 | 103 | ||
103 | bool DBCsv::openSource(QIODevice *inDev) | 104 | bool DBCsv::openSource(QIODevice *inDev) |
104 | { | 105 | { |
105 | QTextStream tsIn(inDev); | 106 | QTextStream tsIn(inDev); |
106 | QString in = tsIn.readLine().stripWhiteSpace(); | 107 | QString in = tsIn.readLine().stripWhiteSpace(); |
107 | QStringList keys; | 108 | QStringList keys; |
108 | 109 | ||
109 | keys = readElem(in); | 110 | keys = readElem(in); |
110 | 111 | ||
111 | QMap<int,int> keyIndexes; | 112 | QMap<int,int> keyIndexes; |
112 | 113 | ||
113 | KeyList *keyR = new KeyList(); | 114 | KeyList *keyR = new KeyList(); |
114 | QStringList::Iterator i = keys.begin(); | 115 | QStringList::Iterator i = keys.begin(); |
115 | 116 | ||
116 | uint fileIndex = 0; | 117 | uint fileIndex = 0; |
117 | while(i != keys.end()) { | 118 | while(i != keys.end()) { |
118 | if ((*i).isEmpty()) | 119 | if ((*i).isEmpty()) |
119 | keyIndexes.insert(fileIndex, keyR->addKey("Unamed", TVVariant::String)); | 120 | keyIndexes.insert(fileIndex, keyR->addKey("Unamed", TVVariant::String)); |
120 | else | 121 | else |
121 | keyIndexes.insert(fileIndex, keyR->addKey(*i, TVVariant::String)); | 122 | keyIndexes.insert(fileIndex, keyR->addKey(*i, TVVariant::String)); |
122 | i++; | 123 | i++; |
123 | fileIndex++; | 124 | fileIndex++; |
124 | } | 125 | } |
125 | dstore->setKeys(keyR); | 126 | dstore->setKeys(keyR); |
126 | 127 | ||
127 | in = tsIn.readLine().stripWhiteSpace(); | 128 | in = tsIn.readLine().stripWhiteSpace(); |
128 | while(!in.isNull()) { | 129 | while(!in.isNull()) { |
129 | QStringList elems = readElem(in); | 130 | QStringList elems = readElem(in); |
130 | 131 | ||
131 | i = elems.begin(); | 132 | i = elems.begin(); |
132 | fileIndex = 0; | 133 | fileIndex = 0; |
133 | DataElem *current_data = new DataElem(dstore); | 134 | DataElem *current_data = new DataElem(dstore); |
134 | while(i != elems.end()) { | 135 | while(i != elems.end()) { |
135 | if(!(*i).isEmpty()) { | 136 | if(!(*i).isEmpty()) { |
136 | current_data->setField(keyIndexes[fileIndex], *i); | 137 | current_data->setField(keyIndexes[fileIndex], *i); |
137 | } | 138 | } |
138 | fileIndex++; | 139 | fileIndex++; |
139 | i++; | 140 | i++; |
140 | } | 141 | } |
141 | dstore->addItem(current_data); | 142 | dstore->addItem(current_data); |
142 | in = tsIn.readLine().stripWhiteSpace(); | 143 | in = tsIn.readLine().stripWhiteSpace(); |
143 | } | 144 | } |
144 | 145 | ||
145 | return TRUE; | 146 | return TRUE; |
146 | } | 147 | } |
147 | 148 | ||
148 | bool DBCsv::saveSource(QIODevice *outDev) | 149 | bool DBCsv::saveSource(QIODevice *outDev) |
diff --git a/noncore/apps/tableviewer/ui/commonwidgets.cpp b/noncore/apps/tableviewer/ui/commonwidgets.cpp index bf4c36f..4c47951 100644 --- a/noncore/apps/tableviewer/ui/commonwidgets.cpp +++ b/noncore/apps/tableviewer/ui/commonwidgets.cpp | |||
@@ -1,133 +1,133 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #include <qlineedit.h> | 21 | #include <qlineedit.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | 25 | ||
26 | #include <qpe/datebookmonth.h> | 26 | #include <qpe/datebookmonth.h> |
27 | #include <qpopupmenu.h> | 27 | #include <qpopupmenu.h> |
28 | #include <qspinbox.h> | 28 | #include <qspinbox.h> |
29 | #include "commonwidgets.h" | 29 | #include "commonwidgets.h" |
30 | 30 | ||
31 | DateEdit::DateEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ) | 31 | DateEdit::DateEdit( QWidget *parent, const char *name, WFlags f ) |
32 | : QToolButton(parent, name) | 32 | : QToolButton(parent, name) |
33 | { | 33 | { |
34 | QPopupMenu *m1 = new QPopupMenu(this); | 34 | QPopupMenu *m1 = new QPopupMenu(this); |
35 | dateSelector = new DateBookMonth(m1, 0, TRUE); | 35 | dateSelector = new DateBookMonth(m1, 0, TRUE); |
36 | m1->insertItem(dateSelector); | 36 | m1->insertItem(dateSelector); |
37 | setPopup(m1); | 37 | setPopup(m1); |
38 | setPopupDelay(0); | 38 | setPopupDelay(0); |
39 | 39 | ||
40 | connect(dateSelector, SIGNAL(dateClicked(int, int, int)), | 40 | connect(dateSelector, SIGNAL(dateClicked(int, int, int)), |
41 | this, SLOT(subValueChanged())); | 41 | this, SLOT(subValueChanged())); |
42 | 42 | ||
43 | setText(dateSelector->selectedDate().toString()); | 43 | setText(dateSelector->selectedDate().toString()); |
44 | } | 44 | } |
45 | 45 | ||
46 | 46 | ||
47 | DateEdit::~DateEdit() {} | 47 | DateEdit::~DateEdit() {} |
48 | 48 | ||
49 | QDate DateEdit::date() const | 49 | QDate DateEdit::date() const |
50 | { | 50 | { |
51 | return dateSelector->selectedDate(); | 51 | return dateSelector->selectedDate(); |
52 | } | 52 | } |
53 | 53 | ||
54 | void DateEdit::setDate(QDate d) | 54 | void DateEdit::setDate(QDate d) |
55 | { | 55 | { |
56 | dateSelector->setDate(d.year(), d.month(), d.day()); | 56 | dateSelector->setDate(d.year(), d.month(), d.day()); |
57 | setText(d.toString()); | 57 | setText(d.toString()); |
58 | } | 58 | } |
59 | 59 | ||
60 | QSizePolicy DateEdit::sizePolicy() const | 60 | QSizePolicy DateEdit::sizePolicy() const |
61 | { | 61 | { |
62 | QSizePolicy sp; | 62 | QSizePolicy sp; |
63 | sp.setHorData(QToolButton::sizePolicy().horData()); | 63 | sp.setHorData(QToolButton::sizePolicy().horData()); |
64 | sp.setVerData(QSizePolicy::Fixed); | 64 | sp.setVerData(QSizePolicy::Fixed); |
65 | 65 | ||
66 | return sp; | 66 | return sp; |
67 | } | 67 | } |
68 | 68 | ||
69 | void DateEdit::clear() | 69 | void DateEdit::clear() |
70 | { | 70 | { |
71 | QDate today = QDate::currentDate(); | 71 | QDate today = QDate::currentDate(); |
72 | 72 | ||
73 | dateSelector->setDate(today.year(), today.month(), today.day()); | 73 | dateSelector->setDate(today.year(), today.month(), today.day()); |
74 | setText(today.toString()); | 74 | setText(today.toString()); |
75 | } | 75 | } |
76 | 76 | ||
77 | void DateEdit::subValueChanged() | 77 | void DateEdit::subValueChanged() |
78 | { | 78 | { |
79 | QDate current = dateSelector->selectedDate(); | 79 | QDate current = dateSelector->selectedDate(); |
80 | 80 | ||
81 | setText(current.toString()); | 81 | setText(current.toString()); |
82 | emit valueChanged(current); | 82 | emit valueChanged(current); |
83 | } | 83 | } |
84 | 84 | ||
85 | TimeEdit::TimeEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ) | 85 | TimeEdit::TimeEdit( QWidget *parent, const char *name, WFlags f ) |
86 | : QWidget(parent, name, f) | 86 | : QWidget(parent, name, f) |
87 | { | 87 | { |
88 | QHBoxLayout *layout = new QHBoxLayout(this, 0); | 88 | QHBoxLayout *layout = new QHBoxLayout(this, 0); |
89 | 89 | ||
90 | layout->addWidget(hourKey = new QSpinBox(1, 12, 1, this)); | 90 | layout->addWidget(hourKey = new QSpinBox(1, 12, 1, this)); |
91 | hourKey->setWrapping(true); | 91 | hourKey->setWrapping(true); |
92 | hourKey->setMinimumWidth(30); | 92 | hourKey->setMinimumWidth(30); |
93 | hourKey->setMaximumWidth(35); | 93 | hourKey->setMaximumWidth(35); |
94 | 94 | ||
95 | layout->addWidget(new QLabel(" : ", this)); | 95 | layout->addWidget(new QLabel(" : ", this)); |
96 | layout->addWidget(minuteKey = new QSpinBox(0, 59, 1, this)); | 96 | layout->addWidget(minuteKey = new QSpinBox(0, 59, 1, this)); |
97 | minuteKey->setWrapping(true); | 97 | minuteKey->setWrapping(true); |
98 | minuteKey->setMinimumWidth(30); | 98 | minuteKey->setMinimumWidth(30); |
99 | minuteKey->setMaximumWidth(35); | 99 | minuteKey->setMaximumWidth(35); |
100 | 100 | ||
101 | layout->addWidget(new QLabel(" : ", this)); | 101 | layout->addWidget(new QLabel(" : ", this)); |
102 | layout->addWidget(secondKey = new QSpinBox(0, 59, 1, this, 0)); | 102 | layout->addWidget(secondKey = new QSpinBox(0, 59, 1, this, 0)); |
103 | secondKey->setWrapping(true); | 103 | secondKey->setWrapping(true); |
104 | secondKey->setMinimumWidth(30); | 104 | secondKey->setMinimumWidth(30); |
105 | secondKey->setMaximumWidth(35); | 105 | secondKey->setMaximumWidth(35); |
106 | 106 | ||
107 | layout->addWidget(ampm = new QComboBox(this)); | 107 | layout->addWidget(ampm = new QComboBox(this)); |
108 | ampm->insertItem("AM"); | 108 | ampm->insertItem("AM"); |
109 | ampm->insertItem("PM"); | 109 | ampm->insertItem("PM"); |
110 | 110 | ||
111 | layout->addStretch(-1); | 111 | layout->addStretch(-1); |
112 | 112 | ||
113 | clear(); | 113 | clear(); |
114 | 114 | ||
115 | connect(secondKey, SIGNAL(valueChanged(const QString&)), | 115 | connect(secondKey, SIGNAL(valueChanged(const QString&)), |
116 | this, SLOT(subValueChanged())); | 116 | this, SLOT(subValueChanged())); |
117 | connect(minuteKey, SIGNAL(valueChanged(const QString&)), | 117 | connect(minuteKey, SIGNAL(valueChanged(const QString&)), |
118 | this, SLOT(subValueChanged())); | 118 | this, SLOT(subValueChanged())); |
119 | connect(hourKey, SIGNAL(valueChanged(const QString&)), | 119 | connect(hourKey, SIGNAL(valueChanged(const QString&)), |
120 | this, SLOT(subValueChanged())); | 120 | this, SLOT(subValueChanged())); |
121 | connect(ampm, SIGNAL(activated(int)), | 121 | connect(ampm, SIGNAL(activated(int)), |
122 | this, SLOT(subValueChanged())); | 122 | this, SLOT(subValueChanged())); |
123 | } | 123 | } |
124 | 124 | ||
125 | 125 | ||
126 | TimeEdit::~TimeEdit() {} | 126 | TimeEdit::~TimeEdit() {} |
127 | 127 | ||
128 | QTime TimeEdit::time() const | 128 | QTime TimeEdit::time() const |
129 | { | 129 | { |
130 | int s,m,h; | 130 | int s,m,h; |
131 | 131 | ||
132 | s = secondKey->text().toInt(); | 132 | s = secondKey->text().toInt(); |
133 | m = minuteKey->text().toInt(); | 133 | m = minuteKey->text().toInt(); |
@@ -145,66 +145,66 @@ QTime TimeEdit::time() const | |||
145 | h = 12; | 145 | h = 12; |
146 | 146 | ||
147 | if(QTime::isValid(h, m, s)) | 147 | if(QTime::isValid(h, m, s)) |
148 | return QTime(h, m, s); | 148 | return QTime(h, m, s); |
149 | return QTime(0, 0, 0); | 149 | return QTime(0, 0, 0); |
150 | } | 150 | } |
151 | 151 | ||
152 | void TimeEdit::setTime(QTime t) | 152 | void TimeEdit::setTime(QTime t) |
153 | { | 153 | { |
154 | int h = t.hour(); | 154 | int h = t.hour(); |
155 | secondKey->setValue(t.second()); | 155 | secondKey->setValue(t.second()); |
156 | minuteKey->setValue(t.minute()); | 156 | minuteKey->setValue(t.minute()); |
157 | 157 | ||
158 | /* h 0..23 */ | 158 | /* h 0..23 */ |
159 | if (h > 11) { | 159 | if (h > 11) { |
160 | h -= 12; | 160 | h -= 12; |
161 | ampm->setCurrentItem(1); | 161 | ampm->setCurrentItem(1); |
162 | } else { | 162 | } else { |
163 | ampm->setCurrentItem(0); | 163 | ampm->setCurrentItem(0); |
164 | } | 164 | } |
165 | 165 | ||
166 | if (h == 0) h = 12; | 166 | if (h == 0) h = 12; |
167 | hourKey->setValue(h); | 167 | hourKey->setValue(h); |
168 | } | 168 | } |
169 | 169 | ||
170 | QSizePolicy TimeEdit::sizePolicy() const | 170 | QSizePolicy TimeEdit::sizePolicy() const |
171 | { | 171 | { |
172 | QSizePolicy sp; | 172 | QSizePolicy sp; |
173 | sp.setHorData(QSizePolicy::Preferred); | 173 | sp.setHorData(QSizePolicy::Preferred); |
174 | sp.setVerData(QSizePolicy::Fixed); | 174 | sp.setVerData(QSizePolicy::Fixed); |
175 | 175 | ||
176 | return sp; | 176 | return sp; |
177 | } | 177 | } |
178 | 178 | ||
179 | void TimeEdit::clear() | 179 | void TimeEdit::clear() |
180 | { | 180 | { |
181 | secondKey->setValue(0); | 181 | secondKey->setValue(0); |
182 | minuteKey->setValue(0); | 182 | minuteKey->setValue(0); |
183 | hourKey->setValue(12); | 183 | hourKey->setValue(12); |
184 | 184 | ||
185 | ampm->setCurrentItem(0); | 185 | ampm->setCurrentItem(0); |
186 | } | 186 | } |
187 | 187 | ||
188 | void TimeEdit::subValueChanged() | 188 | void TimeEdit::subValueChanged() |
189 | { | 189 | { |
190 | emit valueChanged(time()); | 190 | emit valueChanged(time()); |
191 | } | 191 | } |
192 | 192 | ||
193 | IntEdit::IntEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ) | 193 | IntEdit::IntEdit( QWidget *parent, const char *name, WFlags f ) |
194 | : QSpinBox(INT_MIN, INT_MAX, 1, parent, name) | 194 | : QSpinBox(INT_MIN, INT_MAX, 1, parent, name) |
195 | { | 195 | { |
196 | setValue(0); | 196 | setValue(0); |
197 | } | 197 | } |
198 | 198 | ||
199 | 199 | ||
200 | IntEdit::~IntEdit() {} | 200 | IntEdit::~IntEdit() {} |
201 | 201 | ||
202 | int IntEdit::value() | 202 | int IntEdit::value() |
203 | { | 203 | { |
204 | return cleanText().toInt(); | 204 | return cleanText().toInt(); |
205 | } | 205 | } |
206 | 206 | ||
207 | void IntEdit::clear() | 207 | void IntEdit::clear() |
208 | { | 208 | { |
209 | setValue(0); | 209 | setValue(0); |
210 | } | 210 | } |
diff --git a/noncore/apps/tableviewer/ui/tvbrowseview.cpp b/noncore/apps/tableviewer/ui/tvbrowseview.cpp index 9bfc791..f5f2555 100644 --- a/noncore/apps/tableviewer/ui/tvbrowseview.cpp +++ b/noncore/apps/tableviewer/ui/tvbrowseview.cpp | |||
@@ -1,89 +1,89 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "tvbrowseview.h" | 20 | #include "tvbrowseview.h" |
21 | #include "browsekeyentry.h" | 21 | #include "browsekeyentry.h" |
22 | #include <qtoolbutton.h> | 22 | #include <qtoolbutton.h> |
23 | #include <qtextview.h> | 23 | #include <qtextview.h> |
24 | #include <qtextbrowser.h> | 24 | #include <qtextbrowser.h> |
25 | #include <qlayout.h> | 25 | #include <qlayout.h> |
26 | 26 | ||
27 | /*! | 27 | /*! |
28 | \class TVBrowseView | 28 | \class TVBrowseView |
29 | \brief The widget describing how to draw the browse view user interface | 29 | \brief The widget describing how to draw the browse view user interface |
30 | 30 | ||
31 | This widget allows for the user to browse through the table, one element | 31 | This widget allows for the user to browse through the table, one element |
32 | at a time, or search on a single key. Its main goal is to show a | 32 | at a time, or search on a single key. Its main goal is to show a |
33 | single element in a readable format and make it easy for the user to | 33 | single element in a readable format and make it easy for the user to |
34 | rapidly find specific elements in the table. | 34 | rapidly find specific elements in the table. |
35 | */ | 35 | */ |
36 | 36 | ||
37 | /*! | 37 | /*! |
38 | Constructs a new TVBrowseView widget | 38 | Constructs a new TVBrowseView widget |
39 | */ | 39 | */ |
40 | TVBrowseView::TVBrowseView(TableState *t, QWidget* parent = 0, const char *name = 0, | 40 | TVBrowseView::TVBrowseView(TableState *t, QWidget* parent, const char *name, |
41 | WFlags fl =0) | 41 | WFlags fl ) |
42 | { | 42 | { |
43 | if (!name) | 43 | if (!name) |
44 | setName("BrowseView"); | 44 | setName("BrowseView"); |
45 | 45 | ||
46 | // setSizePolicy(QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, 0, 0, sizePolicy().hasHeightForWidth() ) ); | 46 | // setSizePolicy(QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, 0, 0, sizePolicy().hasHeightForWidth() ) ); |
47 | QVBoxLayout *vlayout = new QVBoxLayout(this); | 47 | QVBoxLayout *vlayout = new QVBoxLayout(this); |
48 | textViewDisplay = new QTextBrowser(this, "textViewDisplay"); | 48 | textViewDisplay = new QTextBrowser(this, "textViewDisplay"); |
49 | vlayout->addWidget( textViewDisplay ); | 49 | vlayout->addWidget( textViewDisplay ); |
50 | 50 | ||
51 | keyEntry = new TVBrowseKeyEntry(this, "keyEntry"); | 51 | keyEntry = new TVBrowseKeyEntry(this, "keyEntry"); |
52 | vlayout->addWidget( keyEntry ); | 52 | vlayout->addWidget( keyEntry ); |
53 | 53 | ||
54 | /* connect the signals down */ | 54 | /* connect the signals down */ |
55 | 55 | ||
56 | connect(keyEntry, SIGNAL(searchOnKey(int, TVVariant)), | 56 | connect(keyEntry, SIGNAL(searchOnKey(int, TVVariant)), |
57 | this, SIGNAL(searchOnKey(int, TVVariant))); | 57 | this, SIGNAL(searchOnKey(int, TVVariant))); |
58 | connect(keyEntry, SIGNAL(sortChanged(int)), | 58 | connect(keyEntry, SIGNAL(sortChanged(int)), |
59 | this, SIGNAL(sortChanged(int))); | 59 | this, SIGNAL(sortChanged(int))); |
60 | 60 | ||
61 | ts = t; | 61 | ts = t; |
62 | keyEntry->setTableState(t); | 62 | keyEntry->setTableState(t); |
63 | } | 63 | } |
64 | 64 | ||
65 | /*! | 65 | /*! |
66 | Destroys the TVBrowseView widget | 66 | Destroys the TVBrowseView widget |
67 | */ | 67 | */ |
68 | TVBrowseView::~TVBrowseView() | 68 | TVBrowseView::~TVBrowseView() |
69 | { | 69 | { |
70 | } | 70 | } |
71 | 71 | ||
72 | void TVBrowseView::rebuildData() | 72 | void TVBrowseView::rebuildData() |
73 | { | 73 | { |
74 | if(!ts) | 74 | if(!ts) |
75 | return; | 75 | return; |
76 | if(!ts->current_elem) { | 76 | if(!ts->current_elem) { |
77 | /* also disable buttons */ | 77 | /* also disable buttons */ |
78 | textViewDisplay->setText(""); | 78 | textViewDisplay->setText(""); |
79 | return; | 79 | return; |
80 | } | 80 | } |
81 | 81 | ||
82 | setDisplayText(ts->current_elem); | 82 | setDisplayText(ts->current_elem); |
83 | } | 83 | } |
84 | 84 | ||
85 | /* Reset to initial state */ | 85 | /* Reset to initial state */ |
86 | void TVBrowseView::reset() | 86 | void TVBrowseView::reset() |
87 | { | 87 | { |
88 | textViewDisplay->setText(""); | 88 | textViewDisplay->setText(""); |
89 | keyEntry->reset(); | 89 | keyEntry->reset(); |
diff --git a/noncore/apps/tableviewer/ui/tveditview.cpp b/noncore/apps/tableviewer/ui/tveditview.cpp index ba2bd06..23e2b42 100644 --- a/noncore/apps/tableviewer/ui/tveditview.cpp +++ b/noncore/apps/tableviewer/ui/tveditview.cpp | |||
@@ -1,92 +1,92 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | /* The edit view widget. For each key in the DB display an | 22 | /* The edit view widget. For each key in the DB display an |
23 | * appropriate edit box, and a 'key' button to change that particular | 23 | * appropriate edit box, and a 'key' button to change that particular |
24 | * key information (delete or edit). | 24 | * key information (delete or edit). |
25 | * | 25 | * |
26 | * Bottem line should be a 'new key' button. Should be able to scroll | 26 | * Bottem line should be a 'new key' button. Should be able to scroll |
27 | * in both directions. | 27 | * in both directions. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "tveditview.h" | 30 | #include "tveditview.h" |
31 | #include "commonwidgets.h" | 31 | #include "commonwidgets.h" |
32 | 32 | ||
33 | #include <qlayout.h> | 33 | #include <qlayout.h> |
34 | #include <qgrid.h> | 34 | #include <qgrid.h> |
35 | #include <qvbox.h> | 35 | #include <qvbox.h> |
36 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
37 | #include <qcheckbox.h> | 37 | #include <qcheckbox.h> |
38 | #include <qlist.h> | 38 | #include <qlist.h> |
39 | #include <qlabel.h> | 39 | #include <qlabel.h> |
40 | #include <qscrollview.h> | 40 | #include <qscrollview.h> |
41 | #include <qsignalmapper.h> | 41 | #include <qsignalmapper.h> |
42 | 42 | ||
43 | TVEditView::TVEditView(TableState *s, DataElem *d, QWidget* parent = 0, | 43 | TVEditView::TVEditView(TableState *s, DataElem *d, QWidget* parent, |
44 | const char *name = 0, WFlags fl =0) : QDialog(parent, name, true, fl) | 44 | const char *name, WFlags fl ) : QDialog(parent, name, true, fl) |
45 | { | 45 | { |
46 | if (!name) | 46 | if (!name) |
47 | setName("TVEditView"); | 47 | setName("TVEditView"); |
48 | 48 | ||
49 | QVBoxLayout *layout = new QVBoxLayout(this, 0); /* only so that will resize | 49 | QVBoxLayout *layout = new QVBoxLayout(this, 0); /* only so that will resize |
50 | correctly in other | 50 | correctly in other |
51 | widgets */ | 51 | widgets */ |
52 | 52 | ||
53 | toggles = new QSignalMapper(this); | 53 | toggles = new QSignalMapper(this); |
54 | QScrollView *sv = new QScrollView(this, 0); | 54 | QScrollView *sv = new QScrollView(this, 0); |
55 | sv->setResizePolicy(QScrollView::AutoOneFit); | 55 | sv->setResizePolicy(QScrollView::AutoOneFit); |
56 | 56 | ||
57 | layout->addWidget(sv); | 57 | layout->addWidget(sv); |
58 | 58 | ||
59 | editDisplay = new QGrid(3, sv, 0); | 59 | editDisplay = new QGrid(3, sv, 0); |
60 | editDisplay->setSpacing(3); | 60 | editDisplay->setSpacing(3); |
61 | sv->addChild(editDisplay); | 61 | sv->addChild(editDisplay); |
62 | 62 | ||
63 | connect(toggles, SIGNAL(mapped(int)), this, SLOT(toggleEnabled(int))); | 63 | connect(toggles, SIGNAL(mapped(int)), this, SLOT(toggleEnabled(int))); |
64 | 64 | ||
65 | setData(s, d); | 65 | setData(s, d); |
66 | #ifdef Q_WS_QWS | 66 | #ifdef Q_WS_QWS |
67 | showMaximized(); | 67 | showMaximized(); |
68 | #endif | 68 | #endif |
69 | } | 69 | } |
70 | 70 | ||
71 | TVEditView::~TVEditView() | 71 | TVEditView::~TVEditView() |
72 | { | 72 | { |
73 | } | 73 | } |
74 | 74 | ||
75 | /*! set up the widgets in the grid, Set up initial values */ | 75 | /*! set up the widgets in the grid, Set up initial values */ |
76 | void TVEditView::setData(TableState *t, DataElem *d) | 76 | void TVEditView::setData(TableState *t, DataElem *d) |
77 | { | 77 | { |
78 | 78 | ||
79 | /* TODO need to somehow clear old children... a delete of each | 79 | /* TODO need to somehow clear old children... a delete of each |
80 | * child? */ | 80 | * child? */ |
81 | keyIds.clear(); | 81 | keyIds.clear(); |
82 | 82 | ||
83 | KeyListIterator it(*t->kRep); | 83 | KeyListIterator it(*t->kRep); |
84 | 84 | ||
85 | int i = 0; | 85 | int i = 0; |
86 | while(it.current()) { | 86 | while(it.current()) { |
87 | if (t->kRep->validIndex(it.currentKey())) { | 87 | if (t->kRep->validIndex(it.currentKey())) { |
88 | new QLabel(it.current()->name(), editDisplay); | 88 | new QLabel(it.current()->name(), editDisplay); |
89 | keyIds.insert(i, it.currentKey()); | 89 | keyIds.insert(i, it.currentKey()); |
90 | if (d->hasValidValue(it.currentKey())) { | 90 | if (d->hasValidValue(it.currentKey())) { |
91 | switch(it.current()->type()) { | 91 | switch(it.current()->type()) { |
92 | case TVVariant::String: { | 92 | case TVVariant::String: { |
diff --git a/noncore/apps/tableviewer/ui/tvfilterview.cpp b/noncore/apps/tableviewer/ui/tvfilterview.cpp index 72d39d6..0182127 100644 --- a/noncore/apps/tableviewer/ui/tvfilterview.cpp +++ b/noncore/apps/tableviewer/ui/tvfilterview.cpp | |||
@@ -1,78 +1,78 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "tvfilterview.h" | 20 | #include "tvfilterview.h" |
21 | #include <qtoolbutton.h> | 21 | #include <qtoolbutton.h> |
22 | #include <qcombobox.h> | 22 | #include <qcombobox.h> |
23 | #include <qlistview.h> | 23 | #include <qlistview.h> |
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qheader.h> | 25 | #include <qheader.h> |
26 | #include <qpushbutton.h> | 26 | #include <qpushbutton.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | 28 | ||
29 | TVFilterView::TVFilterView(TableState *t, QWidget* parent = 0, | 29 | TVFilterView::TVFilterView(TableState *t, QWidget* parent, |
30 | const char *name = 0, WFlags fl =0) : QDialog(parent, name, TRUE, fl) | 30 | const char *name, WFlags fl ) : QDialog(parent, name, TRUE, fl) |
31 | { | 31 | { |
32 | if ( !name ) | 32 | if ( !name ) |
33 | setName( "Filter View" ); | 33 | setName( "Filter View" ); |
34 | 34 | ||
35 | QVBoxLayout *vlayout = new QVBoxLayout(this); | 35 | QVBoxLayout *vlayout = new QVBoxLayout(this); |
36 | 36 | ||
37 | display = new QListView(this, "display"); | 37 | display = new QListView(this, "display"); |
38 | display->addColumn("Key"); | 38 | display->addColumn("Key"); |
39 | display->addColumn("Constraint"); | 39 | display->addColumn("Constraint"); |
40 | display->addColumn("Value"); | 40 | display->addColumn("Value"); |
41 | display->header()->setClickEnabled(FALSE); | 41 | display->header()->setClickEnabled(FALSE); |
42 | display->header()->setResizeEnabled(FALSE); | 42 | display->header()->setResizeEnabled(FALSE); |
43 | 43 | ||
44 | vlayout->addWidget(display); | 44 | vlayout->addWidget(display); |
45 | 45 | ||
46 | QHBoxLayout *hlayout = new QHBoxLayout; | 46 | QHBoxLayout *hlayout = new QHBoxLayout; |
47 | hlayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); | 47 | hlayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); |
48 | 48 | ||
49 | newFilterButton = new QPushButton(this, "new Filter"); | 49 | newFilterButton = new QPushButton(this, "new Filter"); |
50 | newFilterButton->setMaximumSize(QSize(50, 32767)); | 50 | newFilterButton->setMaximumSize(QSize(50, 32767)); |
51 | newFilterButton->setText("New"); | 51 | newFilterButton->setText("New"); |
52 | hlayout->addWidget(newFilterButton); | 52 | hlayout->addWidget(newFilterButton); |
53 | 53 | ||
54 | deleteFilterButton = new QPushButton(this, "delete Filter"); | 54 | deleteFilterButton = new QPushButton(this, "delete Filter"); |
55 | deleteFilterButton->setMaximumSize(QSize(50, 32767)); | 55 | deleteFilterButton->setMaximumSize(QSize(50, 32767)); |
56 | deleteFilterButton->setText("Delete"); | 56 | deleteFilterButton->setText("Delete"); |
57 | hlayout->addWidget(deleteFilterButton); | 57 | hlayout->addWidget(deleteFilterButton); |
58 | 58 | ||
59 | clearFilterButton = new QPushButton(this, "delete Filter"); | 59 | clearFilterButton = new QPushButton(this, "delete Filter"); |
60 | clearFilterButton->setMaximumSize(QSize(60, 32767)); | 60 | clearFilterButton->setMaximumSize(QSize(60, 32767)); |
61 | clearFilterButton->setText("Clear All"); | 61 | clearFilterButton->setText("Clear All"); |
62 | hlayout->addWidget(clearFilterButton); | 62 | hlayout->addWidget(clearFilterButton); |
63 | 63 | ||
64 | vlayout->addLayout(hlayout); | 64 | vlayout->addLayout(hlayout); |
65 | 65 | ||
66 | QHBoxLayout *hlayout2 = new QHBoxLayout; | 66 | QHBoxLayout *hlayout2 = new QHBoxLayout; |
67 | 67 | ||
68 | keyNameCombo = new QComboBox(FALSE, this, "key name"); | 68 | keyNameCombo = new QComboBox(FALSE, this, "key name"); |
69 | keyNameCombo->setEnabled(FALSE); | 69 | keyNameCombo->setEnabled(FALSE); |
70 | hlayout2->addWidget(keyNameCombo); | 70 | hlayout2->addWidget(keyNameCombo); |
71 | 71 | ||
72 | QLabel *label = new QLabel(this); | 72 | QLabel *label = new QLabel(this); |
73 | label->setText("has value"); | 73 | label->setText("has value"); |
74 | hlayout2->addWidget(label); | 74 | hlayout2->addWidget(label); |
75 | 75 | ||
76 | keyEntry = new TVFilterKeyEntry(this, "key entry"); | 76 | keyEntry = new TVFilterKeyEntry(this, "key entry"); |
77 | keyEntry->setEnabled(FALSE); | 77 | keyEntry->setEnabled(FALSE); |
78 | 78 | ||
diff --git a/noncore/apps/tableviewer/ui/tvkeyedit.cpp b/noncore/apps/tableviewer/ui/tvkeyedit.cpp index fb7b7fe..4849e87 100644 --- a/noncore/apps/tableviewer/ui/tvkeyedit.cpp +++ b/noncore/apps/tableviewer/ui/tvkeyedit.cpp | |||
@@ -47,98 +47,98 @@ public: | |||
47 | } | 47 | } |
48 | return name; | 48 | return name; |
49 | } | 49 | } |
50 | 50 | ||
51 | /* always sort by key index, ignore i */ | 51 | /* always sort by key index, ignore i */ |
52 | QString key(int, bool) const | 52 | QString key(int, bool) const |
53 | { | 53 | { |
54 | return QString().sprintf("%08d", position); | 54 | return QString().sprintf("%08d", position); |
55 | } | 55 | } |
56 | 56 | ||
57 | void setText(int i, const QString &) | 57 | void setText(int i, const QString &) |
58 | { | 58 | { |
59 | ; | 59 | ; |
60 | } | 60 | } |
61 | 61 | ||
62 | QString getName() const | 62 | QString getName() const |
63 | { | 63 | { |
64 | return name; | 64 | return name; |
65 | } | 65 | } |
66 | 66 | ||
67 | void setName(QString n) | 67 | void setName(QString n) |
68 | { | 68 | { |
69 | name = n; | 69 | name = n; |
70 | repaint(); | 70 | repaint(); |
71 | } | 71 | } |
72 | 72 | ||
73 | TVVariant::KeyType getKeyType() const | 73 | TVVariant::KeyType getKeyType() const |
74 | { | 74 | { |
75 | return keyType; | 75 | return keyType; |
76 | } | 76 | } |
77 | 77 | ||
78 | void setKeyType(TVVariant::KeyType k) | 78 | void setKeyType(TVVariant::KeyType k) |
79 | { | 79 | { |
80 | keyType = k; | 80 | keyType = k; |
81 | repaint(); | 81 | repaint(); |
82 | } | 82 | } |
83 | 83 | ||
84 | inline int getPos() const | 84 | inline int getPos() const |
85 | { | 85 | { |
86 | return position; | 86 | return position; |
87 | } | 87 | } |
88 | 88 | ||
89 | private: | 89 | private: |
90 | QString name; | 90 | QString name; |
91 | TVVariant::KeyType keyType; | 91 | TVVariant::KeyType keyType; |
92 | int position; | 92 | int position; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | TVKeyEdit::TVKeyEdit(TableState *t, QWidget* parent = 0, const char *name = 0, | 95 | TVKeyEdit::TVKeyEdit(TableState *t, QWidget* parent, const char *name, |
96 | WFlags fl = 0) : TVKeyEdit_gen(parent, name, true, fl) | 96 | WFlags fl) : TVKeyEdit_gen(parent, name, true, fl) |
97 | { | 97 | { |
98 | int i; | 98 | int i; |
99 | ts = t; | 99 | ts = t; |
100 | 100 | ||
101 | if(!ts) return; | 101 | if(!ts) return; |
102 | if(!ts->kRep) return; | 102 | if(!ts->kRep) return; |
103 | 103 | ||
104 | working_state = *ts->kRep; | 104 | working_state = *ts->kRep; |
105 | 105 | ||
106 | i = 1; | 106 | i = 1; |
107 | keyTypeEdit->insertItem(TVVariant::typeToName((TVVariant::KeyType)i)); | 107 | keyTypeEdit->insertItem(TVVariant::typeToName((TVVariant::KeyType)i)); |
108 | i++; | 108 | i++; |
109 | keyTypeEdit->insertItem(TVVariant::typeToName((TVVariant::KeyType)i)); | 109 | keyTypeEdit->insertItem(TVVariant::typeToName((TVVariant::KeyType)i)); |
110 | i++; | 110 | i++; |
111 | keyTypeEdit->insertItem(TVVariant::typeToName((TVVariant::KeyType)i)); | 111 | keyTypeEdit->insertItem(TVVariant::typeToName((TVVariant::KeyType)i)); |
112 | i++; | 112 | i++; |
113 | keyTypeEdit->insertItem(TVVariant::typeToName((TVVariant::KeyType)i)); | 113 | keyTypeEdit->insertItem(TVVariant::typeToName((TVVariant::KeyType)i)); |
114 | 114 | ||
115 | KeyListIterator it(*ts->kRep); | 115 | KeyListIterator it(*ts->kRep); |
116 | while(it.current()) { | 116 | while(it.current()) { |
117 | if(t->kRep->validIndex(it.currentKey())) { | 117 | if(t->kRep->validIndex(it.currentKey())) { |
118 | new TVKEListViewItem(it.current()->name(), | 118 | new TVKEListViewItem(it.current()->name(), |
119 | it.current()->type(), | 119 | it.current()->type(), |
120 | it.currentKey(), | 120 | it.currentKey(), |
121 | display); | 121 | display); |
122 | } | 122 | } |
123 | ++it; | 123 | ++it; |
124 | } | 124 | } |
125 | num_keys = ts->kRep->getNumFields(); | 125 | num_keys = ts->kRep->getNumFields(); |
126 | if(display->childCount() > 0) { | 126 | if(display->childCount() > 0) { |
127 | display->setCurrentItem(display->firstChild()); | 127 | display->setCurrentItem(display->firstChild()); |
128 | setTerm(display->currentItem()); | 128 | setTerm(display->currentItem()); |
129 | } else { | 129 | } else { |
130 | deleteKeyButton->setEnabled(FALSE); | 130 | deleteKeyButton->setEnabled(FALSE); |
131 | clearKeysButton->setEnabled(FALSE); | 131 | clearKeysButton->setEnabled(FALSE); |
132 | keyNameEdit->setEnabled(FALSE); | 132 | keyNameEdit->setEnabled(FALSE); |
133 | keyTypeEdit->setEnabled(FALSE); | 133 | keyTypeEdit->setEnabled(FALSE); |
134 | } | 134 | } |
135 | 135 | ||
136 | display->setSorting(0); | 136 | display->setSorting(0); |
137 | #ifdef Q_WS_QWS | 137 | #ifdef Q_WS_QWS |
138 | showMaximized(); | 138 | showMaximized(); |
139 | #endif | 139 | #endif |
140 | } | 140 | } |
141 | 141 | ||
142 | /*! | 142 | /*! |
143 | Destroys the TVKeyEdit widget | 143 | Destroys the TVKeyEdit widget |
144 | */ | 144 | */ |
diff --git a/noncore/apps/tableviewer/ui/tvlistview.cpp b/noncore/apps/tableviewer/ui/tvlistview.cpp index 82d67c6..b25e813 100644 --- a/noncore/apps/tableviewer/ui/tvlistview.cpp +++ b/noncore/apps/tableviewer/ui/tvlistview.cpp | |||
@@ -40,98 +40,98 @@ TVListViewPrivate::TVListViewPrivate(QWidget *parent, const char* name, | |||
40 | ; | 40 | ; |
41 | } | 41 | } |
42 | 42 | ||
43 | class TVListViewItem : public QListViewItem | 43 | class TVListViewItem : public QListViewItem |
44 | { | 44 | { |
45 | public: | 45 | public: |
46 | 46 | ||
47 | TVListViewItem(QListView *parent, DataElem *d); | 47 | TVListViewItem(QListView *parent, DataElem *d); |
48 | ~TVListViewItem(); | 48 | ~TVListViewItem(); |
49 | 49 | ||
50 | QString text(int i) const | 50 | QString text(int i) const |
51 | { | 51 | { |
52 | return data_reference->toQString(i); | 52 | return data_reference->toQString(i); |
53 | } | 53 | } |
54 | 54 | ||
55 | /* Do nothing... all data for this item should be generated */ | 55 | /* Do nothing... all data for this item should be generated */ |
56 | void setText(int i, const QString &) | 56 | void setText(int i, const QString &) |
57 | { | 57 | { |
58 | ; | 58 | ; |
59 | } | 59 | } |
60 | QString key(int i, bool a) const | 60 | QString key(int i, bool a) const |
61 | { | 61 | { |
62 | return data_reference->toSortableQString(i); | 62 | return data_reference->toSortableQString(i); |
63 | } | 63 | } |
64 | 64 | ||
65 | void setDataElem(DataElem *d) | 65 | void setDataElem(DataElem *d) |
66 | { | 66 | { |
67 | data_reference = d; | 67 | data_reference = d; |
68 | } | 68 | } |
69 | 69 | ||
70 | DataElem *getDataElem() { | 70 | DataElem *getDataElem() { |
71 | return data_reference; | 71 | return data_reference; |
72 | } | 72 | } |
73 | private: | 73 | private: |
74 | DataElem *data_reference; | 74 | DataElem *data_reference; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | TVListViewItem::TVListViewItem(QListView *parent, DataElem *d) | 77 | TVListViewItem::TVListViewItem(QListView *parent, DataElem *d) |
78 | : QListViewItem(parent) | 78 | : QListViewItem(parent) |
79 | { | 79 | { |
80 | data_reference = d; | 80 | data_reference = d; |
81 | } | 81 | } |
82 | 82 | ||
83 | TVListViewItem::~TVListViewItem() | 83 | TVListViewItem::~TVListViewItem() |
84 | { | 84 | { |
85 | data_reference = 0; | 85 | data_reference = 0; |
86 | } | 86 | } |
87 | 87 | ||
88 | TVListView::TVListView(TableState *t, QWidget* parent = 0, | 88 | TVListView::TVListView(TableState *t, QWidget* parent, |
89 | const char *name = 0, WFlags fl =0) : QWidget(parent, name, fl) | 89 | const char *name, WFlags fl ) : QWidget(parent, name, fl) |
90 | { | 90 | { |
91 | if (!name) | 91 | if (!name) |
92 | setName("TVListView"); | 92 | setName("TVListView"); |
93 | 93 | ||
94 | // the next two lines need to be rationalized. | 94 | // the next two lines need to be rationalized. |
95 | resize(318,457); | 95 | resize(318,457); |
96 | setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, | 96 | setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, |
97 | (QSizePolicy::SizeType)7, sizePolicy().hasHeightForWidth())); | 97 | (QSizePolicy::SizeType)7, sizePolicy().hasHeightForWidth())); |
98 | setCaption(tr("List View")); | 98 | setCaption(tr("List View")); |
99 | 99 | ||
100 | QVBoxLayout *layout = new QVBoxLayout(this); | 100 | QVBoxLayout *layout = new QVBoxLayout(this); |
101 | layout->setSpacing(0); | 101 | layout->setSpacing(0); |
102 | layout->setMargin(0); | 102 | layout->setMargin(0); |
103 | 103 | ||
104 | listViewDisplay = new TVListViewPrivate(this, "listViewDisplay"); | 104 | listViewDisplay = new TVListViewPrivate(this, "listViewDisplay"); |
105 | layout->addWidget(listViewDisplay); | 105 | layout->addWidget(listViewDisplay); |
106 | 106 | ||
107 | connect(listViewDisplay, SIGNAL(currentChanged(QListViewItem *)), this, | 107 | connect(listViewDisplay, SIGNAL(currentChanged(QListViewItem *)), this, |
108 | SLOT(setCurrent(QListViewItem *))); | 108 | SLOT(setCurrent(QListViewItem *))); |
109 | connect(listViewDisplay, SIGNAL(sortChanged(int)), this, | 109 | connect(listViewDisplay, SIGNAL(sortChanged(int)), this, |
110 | SLOT(setSorting(int))); | 110 | SLOT(setSorting(int))); |
111 | 111 | ||
112 | listViewDisplay->setShowSortIndicator(true); | 112 | listViewDisplay->setShowSortIndicator(true); |
113 | 113 | ||
114 | it = new QListViewItemIterator(listViewDisplay); | 114 | it = new QListViewItemIterator(listViewDisplay); |
115 | ts = t; | 115 | ts = t; |
116 | } | 116 | } |
117 | 117 | ||
118 | TVListView::~TVListView() | 118 | TVListView::~TVListView() |
119 | { | 119 | { |
120 | } | 120 | } |
121 | 121 | ||
122 | void TVListView::addItem(DataElem *d) | 122 | void TVListView::addItem(DataElem *d) |
123 | { | 123 | { |
124 | TVListViewItem *i = new TVListViewItem(listViewDisplay, d); | 124 | TVListViewItem *i = new TVListViewItem(listViewDisplay, d); |
125 | 125 | ||
126 | delete it; | 126 | delete it; |
127 | it = new QListViewItemIterator(i); | 127 | it = new QListViewItemIterator(i); |
128 | } | 128 | } |
129 | 129 | ||
130 | /* remove current (it) item */ | 130 | /* remove current (it) item */ |
131 | void TVListView::removeItem() | 131 | void TVListView::removeItem() |
132 | { | 132 | { |
133 | QListViewItemIterator other(*it); | 133 | QListViewItemIterator other(*it); |
134 | 134 | ||
135 | QListViewItemIterator tmp = *it; | 135 | QListViewItemIterator tmp = *it; |
136 | (*it)++; | 136 | (*it)++; |
137 | if (!it->current()) { | 137 | if (!it->current()) { |