예제 #1
0
People::People(QWidget *parent)
    : XLet(parent),
      m_proxy_model(NULL),
      m_people_entry_manager(this)
{
    setTitle(tr("People"));

    this->ui.setupUi(this);

    m_proxy_model = new PeopleEntrySortFilterProxyModel(this);
    m_model = new PeopleEntryModel(m_people_entry_manager, this);
    m_proxy_model->setSourceModel(m_model);
    ui.entry_table->setModel(m_proxy_model);

    connect(this->ui.entry_filter, SIGNAL(textChanged(const QString &)),
            m_proxy_model, SLOT(setFilter(const QString &)));
    connect(this->ui.entry_filter, SIGNAL(textChanged(const QString &)),
            &m_people_entry_manager, SLOT(updateSearch(const QString &)));
    connect(this->ui.entry_filter, SIGNAL(textChanged(const QString &)),
            this, SLOT(schedulePeopleLookup(const QString &)));
    connect(signal_relayer, SIGNAL(numberSelectionRequested()),
            this, SLOT(numberSelectionRequested()));
    connect(this->ui.entry_filter, SIGNAL(returnPressed()),
            this, SLOT(focusEntryTable()));
    connect(&m_remote_lookup_timer, SIGNAL(timeout()),
            this, SLOT(searchPeople()));
    connect(m_model, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)),
            this, SLOT(dataChanged(const QModelIndex &, const QModelIndex &)));
    this->m_remote_lookup_timer.setSingleShot(true);
    this->m_remote_lookup_timer.setInterval(delay_before_lookup);
    b_engine->sendJsonCommand(MessageFactory::getPeopleHeaders());
}
예제 #2
0
People::People(QWidget *parent)
    : XLet(parent, tr("People"), ":/images/tab-people.svg"),
      m_proxy_model(NULL),
      m_model(NULL),
      m_waiting_status(NULL)
{
    this->ui.setupUi(this);

    m_waiting_status = new QMovie(":/images/waiting-status.gif", QByteArray(), this);

    m_proxy_model = new PeopleEntrySortFilterProxyModel(this);
    m_model = new PeopleEntryModel(this);
    m_proxy_model->setSourceModel(m_model);
    ui.entry_table->setModel(m_proxy_model);

    QAction *search_action = ui.menu->addAction(tr("all"));
    QAction *favorite_action = ui.menu->addAction(tr("favorites"));
    QAction *my_contacts_action = ui.menu->addAction(tr("my contacts"));

    connect(search_action, SIGNAL(triggered()),
            this, SLOT(searchMode()));
    connect(favorite_action, SIGNAL(triggered()),
            this, SLOT(favoriteMode()));
    connect(my_contacts_action, SIGNAL(triggered()),
            this, SLOT(personalContactsMode()));

    this->ui.menu->setSelectedAction(1);

    connect(m_proxy_model, SIGNAL(columnsInserted(const QModelIndex &, int, int)),
            ui.entry_table, SLOT(updateColumnsDelegates(const QModelIndex &, int, int)));
    connect(m_proxy_model, SIGNAL(columnsInserted(const QModelIndex &, int, int)),
            ui.entry_table, SLOT(updateColumnsVisibility(const QModelIndex &, int, int)));
    connect(m_model, SIGNAL(columnsInserted(const QModelIndex &, int, int)),
            this, SLOT(defaultColumnSort(const QModelIndex &, int, int)));

    connect(this->ui.entry_table, SIGNAL(favoriteToggled(const QVariantMap &)),
            this, SLOT(setFavoriteStatus(const QVariantMap &)));
    connect(this->ui.entry_table, SIGNAL(deletePersonalContactClicked(const QVariantMap &)),
            this, SLOT(deletePersonalContact(const QVariantMap &)));
    connect(this->ui.entry_table, SIGNAL(editPersonalContactClicked(const QVariantMap &)),
            this, SLOT(requestEditPersonalContact(const QVariantMap &)));

    connect(this->ui.entry_filter, SIGNAL(textChanged(const QString &)),
            this, SLOT(schedulePeopleLookup(const QString &)));
    connect(this->ui.entry_filter, SIGNAL(returnPressed()),
            this, SLOT(searchPeople()));

    connect(this->ui.new_contact_button, SIGNAL(clicked()),
            this, SLOT(openNewContactDialog()));
    connect(this->ui.import_button, SIGNAL(clicked()),
            this, SLOT(openImportDialog()));
    connect(this->ui.export_button, SIGNAL(clicked()),
            this, SLOT(requestExportPersonalContacts()));
    connect(this->ui.purge_contacts_button, SIGNAL(clicked()),
            this, SLOT(purgePersonalContacts()));

    connect(signal_relayer, SIGNAL(numberSelectionRequested()),
            this, SLOT(numberSelectionRequested()));
    connect(this->ui.entry_filter, SIGNAL(returnPressed()),
            this, SLOT(focusEntryTable()));

    connect(&m_lookup_timer, SIGNAL(timeout()),
            this, SLOT(searchPeople()));
    m_lookup_timer.setSingleShot(true);
    m_lookup_timer.setInterval(delay_before_lookup);

    connect(&m_failure_timer, SIGNAL(timeout()),
            this, SLOT(setFailureStatus()));
    m_failure_timer.setSingleShot(true);
    m_failure_timer.setInterval(delay_before_failure);

    connect(&m_before_waiting_timer, SIGNAL(timeout()),
            this, SLOT(setWaitingStatus()));
    m_before_waiting_timer.setSingleShot(true);
    m_before_waiting_timer.setInterval(delay_before_waiting);

    b_engine->sendJsonCommand(MessageFactory::getPeopleHeaders());
    b_engine->sendJsonCommand(MessageFactory::getRelations());

    this->registerListener("people_headers_result");

    this->registerListener("people_search_result");

    this->registerListener("relations");
    this->registerListener("agent_status_update");
    this->registerListener("endpoint_status_update");
    this->registerListener("user_status_update");

    this->registerListener("people_favorite_update");
    this->registerListener("people_favorites_result");

    this->registerListener("people_export_personal_contacts_csv_result");
    this->registerListener("people_import_personal_contacts_csv_result");
    this->registerListener("people_personal_contact_created");
    this->registerListener("people_personal_contact_deleted");
    this->registerListener("people_personal_contact_raw_result");
    this->registerListener("people_personal_contact_raw_update");
    this->registerListener("people_personal_contacts_purged");
    this->registerListener("people_personal_contacts_result");

    if (PeoplePersonalMigration::needMigration()) {
        PeoplePersonalMigration::noticeAndMigratePersonalContacts(this);
    }
}
예제 #3
0
void search_widget::on_lineEdit_pioneers_textChanged(const QString &arg1)
{
    string currentText = ui->lineEdit_pioneers->text().toStdString();
    searchPeople(currentText);
}