Exemplo n.º 1
0
TagListWidget::TagListWidget(QWidget *parent) :
    QWidget(parent)
{
    setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
    parentLayout = new FlowLayout(this, 0);
    setLayout(parentLayout);

    addButton = new TagWidget("+");
    connect(addButton, SIGNAL(clicked()), this, SLOT(newTagRequested()));

    QLabel *lbl = new QLabel(tr("<b>Tags:</b>"));
    lbl->setIndent(5);
    parentLayout->addWidget(lbl);
    parentLayout->addWidget(addButton);

    m_ignoredFlags.insert(QLatin1String("\\seen"));
    m_ignoredFlags.insert(QLatin1String("\\recent"));
    m_ignoredFlags.insert(QLatin1String("\\deleted"));
    m_ignoredFlags.insert(QLatin1String("\\answered"));
    // We do want to show \Flagged, though
    m_ignoredFlags.insert(QLatin1String("\\draft"));
    m_ignoredFlags.insert(QLatin1String("$mdnsent"));
    m_ignoredFlags.insert(QLatin1String("$forwarded"));
    m_ignoredFlags.insert(QLatin1String("$submitpending"));
    m_ignoredFlags.insert(QLatin1String("$submitted"));
}
Exemplo n.º 2
0
KoTagToolButton::KoTagToolButton(QWidget* parent)
    :QWidget(parent), d(new Private())
{
    QGridLayout* buttonLayout = new QGridLayout(this);
    buttonLayout->setMargin(0);
    buttonLayout->setSpacing(0);

    d->tagToolButton = new QToolButton(this);
    d->tagToolButton->setIcon(koIcon("list-add"));
    d->tagToolButton->setToolTip(i18nc("@info:tooltip", "<qt>Show the tag box options.</qt>"));
    d->tagToolButton->setPopupMode(QToolButton::InstantPopup);
    d->tagToolButton->setEnabled(true);

    QMenu* popup = new QMenu(this);

    KoLineEditAction*  addTagAction = new KoLineEditAction(popup);
    addTagAction->setClickMessage(i18n("New tag"));
    addTagAction->setIcon(koIcon("document-new"));
    addTagAction->closeParentOnTrigger(true);
    popup->addAction(addTagAction);

    connect(addTagAction, SIGNAL(triggered(QString)),
            this, SIGNAL(newTagRequested(QString)));

    d->action_renameTag = new KoLineEditAction(popup);
    d->action_renameTag->setClickMessage(i18n("Rename tag"));
    d->action_renameTag->setIcon(koIcon("edit-rename"));
    d->action_renameTag->closeParentOnTrigger(true);
    popup->addAction(d->action_renameTag);

    connect(d->action_renameTag, SIGNAL(triggered(QString)),
            this, SIGNAL(renamingOfCurrentTagRequested(QString)));

    popup->addSeparator();

    d->action_deleteTag = new QAction(popup);
    d->action_deleteTag->setText(i18n("Delete this tag"));
    d->action_deleteTag->setIcon(koIcon("edit-delete"));
    popup->addAction(d->action_deleteTag);

    connect(d->action_deleteTag, SIGNAL(triggered()),
            this, SIGNAL(deletionOfCurrentTagRequested()));

    popup->addSeparator();

    d->action_undeleteTag = new QAction(popup);
    d->action_undeleteTag->setIcon(koIcon("edit-redo"));
    d->action_undeleteTag->setVisible(false);
    popup->addAction(d->action_undeleteTag);

    connect(d->action_undeleteTag, SIGNAL(triggered()),
            this, SLOT(onTagUndeleteClicked()));

    d->action_purgeTagUndeleteList = new QAction(popup);
    d->action_purgeTagUndeleteList->setText(i18n("Clear undelete list"));
    d->action_purgeTagUndeleteList->setIcon(koIcon("edit-clear"));
    d->action_purgeTagUndeleteList->setVisible(false);
    popup->addAction(d->action_purgeTagUndeleteList);

    connect(d->action_purgeTagUndeleteList, SIGNAL(triggered()),
            this, SIGNAL(purgingOfTagUndeleteListRequested()));

    connect(popup, SIGNAL(aboutToShow()),
            this, SIGNAL(popupMenuAboutToShow()));

    d->tagToolButton->setMenu(popup);
    buttonLayout->addWidget(d->tagToolButton);
}