Diffstat (limited to 'core/pim/osearch/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/osearch/mainwindow.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/pim/osearch/mainwindow.cpp b/core/pim/osearch/mainwindow.cpp index 3dba3a9..41ce5b6 100644 --- a/core/pim/osearch/mainwindow.cpp +++ b/core/pim/osearch/mainwindow.cpp | |||
@@ -15,89 +15,90 @@ | |||
15 | #include <qpe/qpemenubar.h> | 15 | #include <qpe/qpemenubar.h> |
16 | #include <qpe/qpemessagebox.h> | 16 | #include <qpe/qpemessagebox.h> |
17 | #include <qpe/resource.h> | 17 | #include <qpe/resource.h> |
18 | #include <qpe/config.h> | 18 | #include <qpe/config.h> |
19 | #include <qpe/qpetoolbar.h> | 19 | #include <qpe/qpetoolbar.h> |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qaction.h> | 21 | #include <qaction.h> |
22 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
23 | #include <qpopupmenu.h> | 23 | #include <qpopupmenu.h> |
24 | #include <qtoolbutton.h> | 24 | #include <qtoolbutton.h> |
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qfile.h> | 27 | #include <qfile.h> |
28 | #include <qpushbutton.h> | 28 | #include <qpushbutton.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
31 | #include <qtextbrowser.h> | 31 | #include <qtextbrowser.h> |
32 | 32 | ||
33 | #include "olistview.h" | 33 | #include "olistview.h" |
34 | #include "olistviewitem.h" | 34 | #include "olistviewitem.h" |
35 | #include "resultitem.h" | 35 | #include "resultitem.h" |
36 | #include "adresssearch.h" | 36 | #include "adresssearch.h" |
37 | #include "todosearch.h" | 37 | #include "todosearch.h" |
38 | #include "datebooksearch.h" | 38 | #include "datebooksearch.h" |
39 | 39 | #include "applnksearch.h" | |
40 | 40 | ||
41 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : | 41 | MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f ) : |
42 | QMainWindow( parent, name, f ), _currentItem(0) | 42 | QMainWindow( parent, name, f ), _currentItem(0) |
43 | { | 43 | { |
44 | setCaption( tr("OSearch") ); | 44 | setCaption( tr("OSearch") ); |
45 | 45 | ||
46 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 46 | setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
47 | 47 | ||
48 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); | 48 | QFrame *mainFrame = new QFrame( this, "mainFrame" ); |
49 | 49 | ||
50 | mainLayout = new QVBoxLayout( mainFrame ); | 50 | mainLayout = new QVBoxLayout( mainFrame ); |
51 | mainLayout->setSpacing( 0 ); | 51 | mainLayout->setSpacing( 0 ); |
52 | mainLayout->setMargin( 0 ); | 52 | mainLayout->setMargin( 0 ); |
53 | 53 | ||
54 | resultsList = new OListView( mainFrame ); | 54 | resultsList = new OListView( mainFrame ); |
55 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 55 | resultsList->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
56 | mainLayout->addWidget( resultsList ); | 56 | mainLayout->addWidget( resultsList ); |
57 | 57 | ||
58 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); | 58 | detailsFrame = new QFrame( mainFrame, "detailsFrame" ); |
59 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); | 59 | QVBoxLayout *detailsLayout = new QVBoxLayout( detailsFrame ); |
60 | richEdit = new QTextView( detailsFrame ); | 60 | richEdit = new QTextView( detailsFrame ); |
61 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 61 | richEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
62 | detailsLayout->addWidget( richEdit, 0 ); | 62 | detailsLayout->addWidget( richEdit, 0 ); |
63 | QHBoxLayout *buttonLayout = new QHBoxLayout( detailsFrame ); | 63 | QHBoxLayout *buttonLayout = new QHBoxLayout( detailsFrame ); |
64 | detailsLayout->addLayout( buttonLayout, 0 ); | 64 | detailsLayout->addLayout( buttonLayout, 0 ); |
65 | QPushButton *buttonShow = new QPushButton( detailsFrame, "Show" ); | 65 | QPushButton *buttonShow = new QPushButton( detailsFrame, "Show" ); |
66 | buttonShow->setText( tr("show") ); | 66 | buttonShow->setText( tr("show") ); |
67 | // buttonShow->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 67 | // buttonShow->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
68 | QPushButton *buttonEdit = new QPushButton( detailsFrame, "Edit" ); | 68 | QPushButton *buttonEdit = new QPushButton( detailsFrame, "Edit" ); |
69 | buttonEdit->setText( tr("edit") ); | 69 | buttonEdit->setText( tr("edit") ); |
70 | // buttonEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); | 70 | // buttonEdit->setSizePolicy( QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding)); |
71 | buttonLayout->addWidget( buttonShow, 0 ); | 71 | buttonLayout->addWidget( buttonShow, 0 ); |
72 | buttonLayout->addWidget( buttonEdit, 0 ); | 72 | buttonLayout->addWidget( buttonEdit, 0 ); |
73 | 73 | ||
74 | mainLayout->addWidget( detailsFrame, 0 ); | 74 | mainLayout->addWidget( detailsFrame, 0 ); |
75 | detailsFrame->hide(); | 75 | detailsFrame->hide(); |
76 | 76 | ||
77 | adrSearch = new AdressSearch( resultsList, tr("adressbook") ); | 77 | adrSearch = new AdressSearch( resultsList, tr("adressbook") ); |
78 | todoSearch = new TodoSearch( resultsList, tr("todo") ); | 78 | todoSearch = new TodoSearch( resultsList, tr("todo") ); |
79 | datebookSearch = new DatebookSearch( resultsList, tr("datebook") ); | 79 | datebookSearch = new DatebookSearch( resultsList, tr("datebook") ); |
80 | applnkSearch = new AppLnkSearch( resultsList, tr("applications") ); | ||
80 | 81 | ||
81 | makeMenu(); | 82 | makeMenu(); |
82 | setCentralWidget( mainFrame ); | 83 | setCentralWidget( mainFrame ); |
83 | 84 | ||
84 | popupTimer = new QTimer(); | 85 | popupTimer = new QTimer(); |
85 | 86 | ||
86 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); | 87 | connect(popupTimer, SIGNAL(timeout()), SLOT(showPopup())); |
87 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); | 88 | connect(resultsList, SIGNAL(pressed(QListViewItem*)), SLOT(setCurrent(QListViewItem*))); |
88 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); | 89 | connect(resultsList, SIGNAL(clicked(QListViewItem*)), SLOT(stopTimer(QListViewItem*))); |
89 | connect(buttonShow, SIGNAL(clicked()), SLOT( showItem() ) ); | 90 | connect(buttonShow, SIGNAL(clicked()), SLOT( showItem() ) ); |
90 | connect(buttonEdit, SIGNAL(clicked()), SLOT( editItem() ) ); | 91 | connect(buttonEdit, SIGNAL(clicked()), SLOT( editItem() ) ); |
91 | 92 | ||
92 | 93 | ||
93 | } | 94 | } |
94 | 95 | ||
95 | void MainWindow::makeMenu() | 96 | void MainWindow::makeMenu() |
96 | { | 97 | { |
97 | // QPEToolBar *toolBar = new QPEToolBar( this ); | 98 | // QPEToolBar *toolBar = new QPEToolBar( this ); |
98 | // QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | 99 | // QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); |
99 | // QPopupMenu *searchMenu = new QPopupMenu( menuBar ); | 100 | // QPopupMenu *searchMenu = new QPopupMenu( menuBar ); |
100 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); | 101 | // QPopupMenu *viewMenu = new QPopupMenu( menuBar ); |
101 | // QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); | 102 | // QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); |
102 | // | 103 | // |
103 | setToolBarsMovable( false ); | 104 | setToolBarsMovable( false ); |
@@ -134,44 +135,45 @@ void MainWindow::setCurrent(QListViewItem *item) | |||
134 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 135 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
135 | richEdit->setText( res->toRichText() ); | 136 | richEdit->setText( res->toRichText() ); |
136 | detailsFrame->show(); | 137 | detailsFrame->show(); |
137 | }else detailsFrame->hide(); | 138 | }else detailsFrame->hide(); |
138 | //_currentItem = (OListViewItem*)item; | 139 | //_currentItem = (OListViewItem*)item; |
139 | popupTimer->start( 300 ); | 140 | popupTimer->start( 300 ); |
140 | } | 141 | } |
141 | 142 | ||
142 | void MainWindow::stopTimer(QListViewItem*) | 143 | void MainWindow::stopTimer(QListViewItem*) |
143 | { | 144 | { |
144 | popupTimer->stop(); | 145 | popupTimer->stop(); |
145 | } | 146 | } |
146 | 147 | ||
147 | void MainWindow::showPopup() | 148 | void MainWindow::showPopup() |
148 | { | 149 | { |
149 | qDebug("showPopup"); | 150 | qDebug("showPopup"); |
150 | if (!_item) return; | 151 | if (!_item) return; |
151 | } | 152 | } |
152 | 153 | ||
153 | void MainWindow::setSearch( const QString &key ) | 154 | void MainWindow::setSearch( const QString &key ) |
154 | { | 155 | { |
155 | adrSearch->setSearch(key); | 156 | adrSearch->setSearch(key); |
156 | todoSearch->setSearch(key); | 157 | todoSearch->setSearch(key); |
157 | datebookSearch->setSearch(key); | 158 | datebookSearch->setSearch(key); |
159 | applnkSearch->setSearch(key); | ||
158 | } | 160 | } |
159 | 161 | ||
160 | 162 | ||
161 | void MainWindow::showItem() | 163 | void MainWindow::showItem() |
162 | { | 164 | { |
163 | if (_currentItem->rtti() == OListViewItem::Result){ | 165 | if (_currentItem->rtti() == OListViewItem::Result){ |
164 | ResultItem *res = (ResultItem*)_currentItem; | 166 | ResultItem *res = (ResultItem*)_currentItem; |
165 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 167 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
166 | res->showItem(); | 168 | res->showItem(); |
167 | } | 169 | } |
168 | } | 170 | } |
169 | 171 | ||
170 | void MainWindow::editItem() | 172 | void MainWindow::editItem() |
171 | { | 173 | { |
172 | if (_currentItem->rtti() == OListViewItem::Result){ | 174 | if (_currentItem->rtti() == OListViewItem::Result){ |
173 | ResultItem *res = (ResultItem*)_currentItem; | 175 | ResultItem *res = (ResultItem*)_currentItem; |
174 | // ResultItem *res = dynamic_cast<ResultItem*>(item); | 176 | // ResultItem *res = dynamic_cast<ResultItem*>(item); |
175 | res->editItem(); | 177 | res->editItem(); |
176 | } | 178 | } |
177 | } | 179 | } |