Пример #1
0
void ViewTableListWidget::createRightMenuActions()
{
    //创建右键菜单
     lookupView_action = new QAction(tr("查看"),this);
     newview_action = new QAction(tr("新建"),this);
     editview_aciton = new QAction(tr("编辑"),this);
     sendview_action = new QAction(tr("发送"),this);
     deleteview_action = new QAction(tr("删除"),this);
     addto_action = new QAction(tr("添加到..."),this);

     detailinfolist_action = new QAction(tr("详细信息"),this);
     listmode_action = new QAction(tr("列表"),this);
     iconmode_action = new QAction(tr("图标"),this);
     sortbyname_aciton = new QAction(tr("名称"),this);
     sortbytype_action = new QAction(tr("类型"),this);
     sortbyfrequency_action = new QAction(tr("使用次数"),this);
     sortbymoditime_action = new QAction(tr("访问时间"),this);

     connect(lookupView_action,SIGNAL(triggered()),this,SLOT(lookupView()));
     connect(newview_action,SIGNAL(triggered()),this,SLOT(newView()));
     connect(editview_aciton,SIGNAL(triggered()),this,SLOT(editView()));
     connect(sendview_action,SIGNAL(triggered()),this,SLOT(sendView()));
     connect(deleteview_action,SIGNAL(triggered()),this,SLOT(deleteViewRequest()));
     connect(addto_action,SIGNAL(triggered()),this,SLOT(addViewTo()));

     connect(detailinfolist_action,SIGNAL(triggered()),this,SLOT(detailInfoPermutation()));
     connect(listmode_action,SIGNAL(triggered()),this,SLOT(listPermutation()));
     connect(iconmode_action,SIGNAL(triggered()),this,SLOT(iconPermutation()));
     connect(sortbyname_aciton,SIGNAL(triggered()),this,SLOT(sortByName()));
     connect(sortbytype_action,SIGNAL(triggered()),this,SLOT(sortByType()));
     connect(sortbyfrequency_action,SIGNAL(triggered()),this,SLOT(sortByFrequency()));
     connect(sortbymoditime_action,SIGNAL(triggered()),this,SLOT(sortByModiTime()));
}
Пример #2
0
void ViewManager::addView()
{
    AddViewDialog dialog(&mViewFactoryDict, this);

    if(dialog.exec())
    {
        QString newName = dialog.viewName();
        QString type = dialog.viewType();

        // Check for name conflicts
        bool firstConflict = true;
        int numTries = 1;
        while(mViewNameList.contains(newName) > 0)
        {
            if(!firstConflict)
            {
                newName = newName.left(newName.length() - 4);
                firstConflict = false;
            }

            newName = QString("%1 <%2>").arg(newName).arg(numTries);
            numTries++;
        }

        // Add the new one to the list
        mViewNameList.append(newName);

        // write the view to the config file,
        KConfig *config = mCore->config();
        config->deleteGroup(newName);
        KConfigGroupSaver saver(config, newName);
        config->writeEntry("Type", type);

        // try to set the active view
        mActionSelectView->setItems(mViewNameList);
        mActionSelectView->setCurrentItem(mViewNameList.findIndex(newName));
        setActiveView(newName);

        editView();

        mActionDeleteView->setEnabled(mViewNameList.count() > 1);
    }
}
Пример #3
0
void ViewManager::initActions()
{
    mActionSelectView = new KSelectAction(i18n("Select View"), 0, mCore->actionCollection(), "select_view");
#if KDE_VERSION >= 309
    mActionSelectView->setMenuAccelsEnabled(false);
#endif
    connect(mActionSelectView, SIGNAL(activated(const QString &)),
            SLOT(setActiveView(const QString &)));

    KAction *action;

    action = new KAction(i18n("Modify View..."), "configure", 0, this,
                         SLOT(editView()), mCore->actionCollection(),
                         "view_modify");
    action->setWhatsThis(
        i18n("By pressing this button a dialog opens that allows you to modify the view of the addressbook. There you can add or remove fields that you want to be shown or hidden in the addressbook like the name for example."));

    action = new KAction(i18n("Add View..."), "window_new", 0, this,
                         SLOT(addView()), mCore->actionCollection(),
                         "view_add");
    action->setWhatsThis(
        i18n("You can add a new view by choosing one from the dialog that appears after pressing the button. You have to give the view a name, so that you can distinguish between the different views."));

    mActionDeleteView = new KAction(i18n("Delete View"), "view_remove", 0,
                                    this, SLOT(deleteView()),
                                    mCore->actionCollection(), "view_delete");
    mActionDeleteView->setWhatsThis(i18n("By pressing this button you can delete the actual view, which you have added before."));

    action = new KAction(i18n("Refresh View"), "reload", 0, this,
                         SLOT(refreshView()), mCore->actionCollection(),
                         "view_refresh");
    action->setWhatsThis(i18n("The view will be refreshed by pressing this button."));

    action = new KAction(i18n("Edit &Filters..."), "filter", 0, this,
                         SLOT(configureFilters()), mCore->actionCollection(),
                         "options_edit_filters");
    action->setWhatsThis(i18n("Edit the contact filters<p>You will be presented with a dialog, where you can add, remove and edit filters."));
}