- Timestamp:
- 01/28/10 22:55:25 (13 years ago)
- Branches:
- master, qt5
- Children:
- 8b0bf22
- Parents:
- 83020cd
- Location:
- src/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/gui/daynavigatorwidget.cpp
r83020cd rbcf67d6 90 90 } 91 91 92 QDate DayNavigatorWidget::getCurrentDate()93 {94 return mCurDate;95 }96 97 92 void DayNavigatorWidget::paintEvent(QPaintEvent *aEvent) 98 93 { -
src/gui/daynavigatorwidget.h
r83020cd rbcf67d6 59 59 ~DayNavigatorWidget() {} 60 60 void setDates(const QDate &aStartDate, const QDate &aEndDate); 61 QDate getCurrentDate();62 61 protected: 63 62 void paintEvent(QPaintEvent *); -
src/gui/searchtabcontainer.cpp
r83020cd rbcf67d6 2 2 #include "searchtabcontainer.h" 3 3 #include "searchhead.h" 4 4 #include <QMessageBox> 5 5 6 6 SearchTabContainer::SearchTabContainer(QWidget *aParent) : TabContainer( aParent ) … … 66 66 67 67 QString keyword = searchHeader->searchEdit->text().replace( QString("%"), QString("\\%") ); 68 qDebug() << "\nKeyword to search: " << keyword;68 //qDebug() << "\nKeyword to search: " << keyword; 69 69 70 70 int confId = Conference::activeConference(); … … 73 73 QDate startDate = Conference::getById(confId).start(); 74 74 QDate endDate = Conference::getById(confId).end(); 75 dayNavigator->setDates(startDate, endDate); 76 updateTreeView( Conference::getById(confId).start() ); 75 76 int nrofFounds = 0; 77 QDate firstDateWithFounds = endDate; 78 QDate lastDateWithFounds = startDate; 79 for(QDate d=startDate; d<=endDate; d=d.addDays(1)) 80 { 81 try{ 82 int count = Event::getSearchResultByDate(d, confId, "start").count(); 83 if(count && (firstDateWithFounds==endDate)) 84 firstDateWithFounds=d; 85 if(count) 86 lastDateWithFounds=d; 87 nrofFounds+=count; 88 } 89 catch( OrmException &e ){ 90 qDebug() << "Event::getSearchResultByDate failed: " << e.text(); 91 } 92 catch(...){ 93 qDebug() << "Event::getSearchResultByDate failed"; 94 } 95 } 96 97 if(!nrofFounds) 98 { 99 // TODO: display some message 100 treeView->hide(); 101 searchAgainButton->hide(); 102 dayNavigator->hide(); 103 header->show(); 104 QMessageBox::information( 105 this, 106 QString("Keyword '%1' not found!").arg(keyword), 107 QString("No events containing '%1' found!").arg(keyword), 108 QMessageBox::Ok); 109 } 110 else 111 { 112 searchAgainButton->show(); 113 dayNavigator->show(); 114 treeView->show(); 115 header->hide(); 116 117 updateTreeView( firstDateWithFounds ); 118 dayNavigator->setDates(firstDateWithFounds, lastDateWithFounds); 119 } 77 120 } 78 121 79 122 void SearchTabContainer::searchAgainClicked() 80 123 { 81 qDebug() << "SearchTab::searchAgainClicked()";82 124 header->show(); 83 125 searchAgainButton->hide(); … … 88 130 void SearchTabContainer::loadEvents( const QDate &aDate, const int aConferenceId ) 89 131 { 90 int eventsCount = static_cast<EventModel*>(treeView->model())->loadSearchResultEvents( aDate, aConferenceId ); 91 if( eventsCount || 92 //TODO: this is not good test 93 dayNavigator->getCurrentDate() != Conference::getById( aConferenceId ).start() 94 ){ 95 searchAgainButton->show(); 96 dayNavigator->show(); 97 treeView->show(); 98 header->hide(); 99 } 100 else{ 101 treeView->hide(); 102 searchAgainButton->hide(); 103 dayNavigator->hide(); 104 header->show(); 105 } 132 static_cast<EventModel*>(treeView->model())->loadSearchResultEvents( aDate, aConferenceId ); 106 133 } 134
Note: See TracChangeset
for help on using the changeset viewer.