qtmobility/examples/samplephonebook/phonebook.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 5 453da2cfceef
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    55     connect(m_editorPage, SIGNAL(showListPage()), this, SLOT(activateList()));
    55     connect(m_editorPage, SIGNAL(showListPage()), this, SLOT(activateList()));
    56 
    56 
    57     m_filterPage = new FilterPage(centralWidget);
    57     m_filterPage = new FilterPage(centralWidget);
    58     connect(m_filterPage, SIGNAL(showListPage(QContactFilter)), this, SLOT(activateList(QContactFilter)));
    58     connect(m_filterPage, SIGNAL(showListPage(QContactFilter)), this, SLOT(activateList(QContactFilter)));
    59 
    59 
    60     m_listPage = new ContactListPage(centralWidget);
    60     m_listPage = new ContactListPage(this, centralWidget);
    61     connect(m_listPage, SIGNAL(showEditorPage(QContactLocalId)), this, SLOT(activateEditor(QContactLocalId)));
    61     connect(m_listPage, SIGNAL(showEditorPage(QContactLocalId)), this, SLOT(activateEditor(QContactLocalId)));
    62     connect(m_listPage, SIGNAL(showFilterPage(QContactFilter)), this, SLOT(activateFind()));
    62     connect(m_listPage, SIGNAL(showFilterPage(QContactFilter)), this, SLOT(activateFind()));
    63     connect(m_listPage, SIGNAL(managerChanged(QContactManager*)), this, SLOT(managerChanged(QContactManager*)));
    63     connect(m_listPage, SIGNAL(managerChanged(QContactManager*)), this, SLOT(managerChanged(QContactManager*)));
       
    64     connect(m_listPage, SIGNAL(clearFilter()), m_filterPage, SLOT(clearFilter()));
    64 
    65 
    65     m_stackedWidget = new QStackedWidget(centralWidget);
    66     m_stackedWidget = new QStackedWidget(centralWidget);
    66     m_stackedWidget->addWidget(m_listPage);
    67     m_stackedWidget->addWidget(m_listPage);
    67     m_stackedWidget->addWidget(m_editorPage);
    68     m_stackedWidget->addWidget(m_editorPage);
    68     m_stackedWidget->addWidget(m_filterPage);
    69     m_stackedWidget->addWidget(m_filterPage);
    79 {
    80 {
    80 }
    81 }
    81 
    82 
    82 void PhoneBook::activateEditor(QContactLocalId contactId)
    83 void PhoneBook::activateEditor(QContactLocalId contactId)
    83 {
    84 {
       
    85     menuBar()->setVisible(false);
    84     m_editorPage->setCurrentContact(m_manager, contactId);
    86     m_editorPage->setCurrentContact(m_manager, contactId);
    85     m_stackedWidget->setCurrentIndex(1); // list = 0, editor = 1, find = 2.
    87     m_stackedWidget->setCurrentIndex(1); // list = 0, editor = 1, find = 2.
    86 }
    88 }
    87 
    89 
    88 void PhoneBook::activateList(const QContactFilter& filter)
    90 void PhoneBook::activateList(const QContactFilter& filter)
    89 {  
    91 {
       
    92 #if !(defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6))
       
    93     menuBar()->setVisible(true);
       
    94 #endif
    90     m_currentFilter = filter;
    95     m_currentFilter = filter;
    91     activateList(); // call base now.
    96     activateList(); // call base now.
    92 }
    97 }
    93 
    98 
    94 void PhoneBook::activateList()
    99 void PhoneBook::activateList()
    95 {
   100 {
       
   101 #if !(defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6))
       
   102     menuBar()->setVisible(true);
       
   103 #endif
    96     m_listPage->rebuildList(m_currentFilter);
   104     m_listPage->rebuildList(m_currentFilter);
    97     m_stackedWidget->setCurrentIndex(0); // list = 0, editor = 1, find = 2.
   105     m_stackedWidget->setCurrentIndex(0); // list = 0, editor = 1, find = 2.
    98 }
   106 }
    99 
   107 
   100 void PhoneBook::activateFind()
   108 void PhoneBook::activateFind()
   101 {
   109 {
       
   110     menuBar()->setVisible(false);
   102     m_stackedWidget->setCurrentIndex(2); // list = 0, editor = 1, find = 2.
   111     m_stackedWidget->setCurrentIndex(2); // list = 0, editor = 1, find = 2.
   103 }
   112 }
   104 
   113 
   105 void PhoneBook::managerChanged(QContactManager *manager)
   114 void PhoneBook::managerChanged(QContactManager *manager)
   106 {
   115 {