Ignore:
Timestamp:
01/21/10 15:12:57 (12 years ago)
Author:
timkoma <timkoma@…>
Branches:
master, qt5
Children:
e493054
Parents:
6a807e7
Message:

update for the search

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/mainwindow.cpp

    r6a807e7 r9d8946b  
    4646    connect(trackDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateTracksView(const QDate &)));
    4747    connect(favouriteDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateFavouritesView(const QDate &)));
     48    connect(searchDayNavigator, SIGNAL(dateChanged(const QDate &)), SLOT(updateSearchView(const QDate &)));
    4849
    4950    // DAY EVENTS View
     
    7879        searchTreeView->setModel(new EventModel());
    7980        searchTreeView->setItemDelegate(new Delegate(searchTreeView));
    80         searchTreeView->setVisible(false);
    81         searchDayNavigator->setVisible(false);
     81
    8282    // event clicked
    8383    connect(dayTreeView, SIGNAL(clicked(const QModelIndex &)), SLOT(itemClicked(const QModelIndex &)));
     
    117117    connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTab(int)));
    118118
     119    searchTreeView->hide();
     120    searchDayNavigator->hide();
     121
    119122    // open dialog for given Event ID
    120123    // this is used in case Alarm Dialog request application to start
     
    209212        }
    210213        break;
     214    case 3: //index 3 of tabWidget: searchTab
     215       {
     216           updateSearchView( searchDayNavigator->getCurrentDate() );
     217       }
     218       break;
    211219    default:
    212220        {
     
    228236    favTreeView->reset();
    229237    favouriteDayNavigator->show();
     238}
     239
     240void MainWindow::updateSearchView(const QDate &aDate)
     241{
     242    searchTreeView->reset();
     243    int eventsCount = static_cast<EventModel*>(searchTreeView->model())->loadSearchResultEvents(aDate,confId);
     244    if( eventsCount ){
     245        searchDayNavigator->show();
     246        searchTreeView->show();
     247    }
     248    else{
     249        searchTreeView->hide();
     250        searchDayNavigator->hide();
     251    }
    230252}
    231253
     
    270292        columns.append( "abstract" );
    271293
    272     searchTreeView->reset();
    273     if( mSqlEngine->searchEvent( confId, columns, searchEdit->text() ) > 0 ){
    274         static_cast<EventModel*>(searchTreeView->model())->loadSearchResultEvents(Conference::getById(confId).start(),confId);
    275         searchDayNavigator->show();
    276         searchTreeView->show();
    277     }
    278 }
    279 
     294    mSqlEngine->searchEvent( confId, columns, searchEdit->text() );
     295    updateSearchView( Conference::getById(confId).start() );
     296}
     297
Note: See TracChangeset for help on using the changeset viewer.