Example #1
0
void ReviewsModel::SetSortField(const QString& sortField)
{
    if (m_SortField != sortField) {
        m_SortField = sortField;
        emit sortFieldChanged();
    }
}
Example #2
0
void AsemanFileSystemModel::setSortField(int field)
{
    if(p->sortField == field)
    {
        return;
    }

    p->sortField = field;
    emit sortFieldChanged();

    refresh();
}
Example #3
0
void ViewManager::setActiveView(const QString &name)
{
    KAddressBookView *view = 0;

    // Check that this isn't the same as the current active view
    if(mActiveView && (mActiveView->caption() == name))
        return;

    // At this point we know the view that should be active is not
    // currently active. We will try to find the new on in the list. If
    // we can't find it, it means it hasn't been instantiated, so we will
    // create it on demand.

    view = mViewDict.find(name);

    // Check if we found the view. If we didn't, then we need to create it
    if(view == 0)
    {
        KConfig *config = mCore->config();
        KConfigGroupSaver saver(config, name);
        QString type = config->readEntry("Type", "Table");

        kdDebug(5720) << "ViewManager::setActiveView: creating view - " << name << endl;

        ViewFactory *factory = mViewFactoryDict.find(type);
        if(factory)
            view = factory->view(mCore, mViewWidgetStack);

        if(view)
        {
            view->setCaption(name);
            mViewDict.insert(name, view);
            mViewWidgetStack->addWidget(view);
            view->readConfig(config);

            // The manager just relays the signals
            connect(view, SIGNAL(selected(const QString &)),
                    SIGNAL(selected(const QString &)));
            connect(view, SIGNAL(executed(const QString &)),
                    SIGNAL(executed(const QString &)));
            connect(view, SIGNAL(modified()), SIGNAL(modified()));
            connect(view, SIGNAL(dropped(QDropEvent *)),
                    SLOT(dropped(QDropEvent *)));
            connect(view, SIGNAL(startDrag()), SLOT(startDrag()));
            connect(view, SIGNAL(sortFieldChanged()), SIGNAL(sortFieldChanged()));
        }
    }

    // If we found or created the view, raise it and refresh it
    if(view)
    {
        mActiveView = view;
        mViewWidgetStack->raiseWidget(view);
        // Set the proper filter in the view. By setting the combo
        // box, the activated slot will be called, which will push
        // the filter to the view and refresh it.
        if(view->defaultFilterType() == KAddressBookView::None)
        {
            mFilterSelectionWidget->setCurrentItem(0);
            setActiveFilter(0);
        }
        else if(view->defaultFilterType() == KAddressBookView::Active)
        {
            setActiveFilter(mFilterSelectionWidget->currentItem());
        }
        else
        {
            uint pos = filterPosition(view->defaultFilterName());
            mFilterSelectionWidget->setCurrentItem(pos);
            setActiveFilter(pos);
        }

        // Update the inc search widget to show the fields in the new active
        // view.
        mActiveView->refresh();

    }
    else
        kdDebug(5720) << "ViewManager::setActiveView: unable to find view\n";
}