author | llornkcor <llornkcor> | 2004-04-07 13:07:42 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2004-04-07 13:07:42 (UTC) |
commit | fc42c7317c956e5bc6e74bfbb1ec185d2faa79f4 (patch) (unidiff) | |
tree | 703e89c7178f764aab25028d4525f74340b28dcb /noncore/apps/opie-gutenbrowser/SearchDialog.cpp | |
parent | 9e1ecade17a77c3d50aecc4c92091d852e99e8d9 (diff) | |
download | opie-fc42c7317c956e5bc6e74bfbb1ec185d2faa79f4.zip opie-fc42c7317c956e5bc6e74bfbb1ec185d2faa79f4.tar.gz opie-fc42c7317c956e5bc6e74bfbb1ec185d2faa79f4.tar.bz2 |
add gutenbrowser
Diffstat (limited to 'noncore/apps/opie-gutenbrowser/SearchDialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-gutenbrowser/SearchDialog.cpp | 135 |
1 files changed, 135 insertions, 0 deletions
diff --git a/noncore/apps/opie-gutenbrowser/SearchDialog.cpp b/noncore/apps/opie-gutenbrowser/SearchDialog.cpp new file mode 100644 index 0000000..dab4789 --- a/dev/null +++ b/noncore/apps/opie-gutenbrowser/SearchDialog.cpp | |||
@@ -0,0 +1,135 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Created: Tue Aug 29 11:45:00 2000**/ | ||
3 | // copyright : (C) 2000 -2004 by llornkcor | ||
4 | // email : ljp@llornkcor.com | ||
5 | |||
6 | #include "SearchDialog.h" | ||
7 | #include "SearchResults.h" | ||
8 | |||
9 | #include <qlayout.h> | ||
10 | #include <qcheckbox.h> | ||
11 | #include <qlabel.h> | ||
12 | #include <qlineedit.h> | ||
13 | #include <qpushbutton.h> | ||
14 | #include <qvariant.h> | ||
15 | #include <qtooltip.h> | ||
16 | #include <qwhatsthis.h> | ||
17 | #include <qmessagebox.h> | ||
18 | #include <qdir.h> | ||
19 | #include <qpe/config.h> | ||
20 | |||
21 | /*This is just a single text entry dialog */ | ||
22 | SearchDialog::SearchDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | ||
23 | : QDialog( parent, name, modal, fl ) | ||
24 | { | ||
25 | if ( !name ) | ||
26 | setName( "SearchDialog" ); | ||
27 | Config cfg("Gutenbrowser"); | ||
28 | cfg.setGroup("General"); | ||
29 | QString lastSearch=cfg.readEntry("LastSearch",""); | ||
30 | |||
31 | #warning FIXME | ||
32 | // FIXME | ||
33 | resize( 220,100); | ||
34 | |||
35 | QGridLayout *layout = new QGridLayout( this ); | ||
36 | layout->setSpacing( 2); | ||
37 | layout->setMargin( 2); | ||
38 | |||
39 | QString local_library = (QDir::homeDirPath ()) +"/Applications/gutenbrowser/"; | ||
40 | TextLabel1 = new QLabel( this, "TextLabel1" ); | ||
41 | layout->addMultiCellWidget( TextLabel1, 0, 0, 0, 1); | ||
42 | |||
43 | label1Str= "<P>Enter text to search etext for </P>" ; | ||
44 | TextLabel1->setText( tr( label1Str) ); | ||
45 | |||
46 | SearchLineEdit = new QLineEdit( this, "SearchLineEdit" ); | ||
47 | layout->addMultiCellWidget( SearchLineEdit, 1, 1, 0, 1); | ||
48 | |||
49 | buttonOk = new QPushButton( this, "buttonOk" ); | ||
50 | buttonOk->setText( tr( "Sea&rch" ) ); | ||
51 | buttonOk->setAutoDefault( TRUE ); | ||
52 | buttonOk->setToggleButton( TRUE); | ||
53 | buttonOk->setDefault( TRUE ); | ||
54 | |||
55 | layout->addMultiCellWidget(buttonOk, 2, 2, 0, 0); | ||
56 | |||
57 | buttonCancel = new QPushButton( this, "buttonCancel" ); | ||
58 | buttonCancel->setText( tr( "&Cancel" ) ); | ||
59 | buttonCancel->setAutoDefault( TRUE ); | ||
60 | // buttonCancel->setMaximumWidth(40); | ||
61 | |||
62 | |||
63 | if( (QString)name !="Etext Search" ) | ||
64 | SearchLineEdit->setText(lastSearch); | ||
65 | |||
66 | caseSensitiveCheckBox = new QCheckBox ( tr("Case Sensitive"), this ); | ||
67 | layout->addMultiCellWidget( caseSensitiveCheckBox, 3, 3, 0, 1); | ||
68 | |||
69 | // signals and slots connections | ||
70 | connect( buttonOk, SIGNAL( clicked() ), this, SLOT( byeBye() ) ); | ||
71 | |||
72 | connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( closed() ) ); | ||
73 | SearchLineEdit->setFocus(); | ||
74 | } | ||
75 | |||
76 | SearchDialog::~SearchDialog() | ||
77 | { | ||
78 | } | ||
79 | |||
80 | QString SearchDialog::get_text() { | ||
81 | return SearchLineEdit->text(); | ||
82 | } | ||
83 | |||
84 | bool SearchDialog::get_direction() { | ||
85 | return false; //search forward | ||
86 | } | ||
87 | |||
88 | bool SearchDialog::case_sensitive() { | ||
89 | return true; | ||
90 | } | ||
91 | |||
92 | bool SearchDialog::forward_search() { | ||
93 | return true; | ||
94 | } | ||
95 | |||
96 | void SearchDialog::byeBye() | ||
97 | { | ||
98 | |||
99 | searchString = get_text(); | ||
100 | // qDebug("Search string is "+searchString); | ||
101 | Config cfg("Gutenbrowser"); | ||
102 | cfg.setGroup("General"); | ||
103 | cfg.writeEntry("LastSearch",searchString); | ||
104 | |||
105 | QString thisName=name(); | ||
106 | if( thisName.find("Library Search", 0, TRUE) != -1) { | ||
107 | // searchString = SearchLineEdit->text(); | ||
108 | accept(); | ||
109 | } else { | ||
110 | |||
111 | buttonOk->setDown(TRUE); | ||
112 | |||
113 | emit search_signal(); | ||
114 | buttonOk->setDown(FALSE); | ||
115 | } | ||
116 | } | ||
117 | |||
118 | void SearchDialog::closed() | ||
119 | { | ||
120 | searchString = get_text(); | ||
121 | // qDebug("Search string is "+searchString); | ||
122 | Config cfg("Gutenbrowser"); | ||
123 | cfg.setGroup("General"); | ||
124 | cfg.writeEntry("LastSearch",searchString); | ||
125 | |||
126 | emit search_done_signal(); | ||
127 | //this->reject(); | ||
128 | this->hide(); | ||
129 | } | ||
130 | |||
131 | |||
132 | void SearchDialog::setLabel(QString labelText) | ||
133 | { | ||
134 | TextLabel1->setText( tr( label1Str+labelText) ); | ||
135 | } | ||