KeyboardProfileDialog::KeyboardProfileDialog(const QString &profile, const QHash<QString, KeyboardProfile> &profiles, QWidget *parent) : Dialog(parent),
	m_profile(profile),
	m_isModified(profiles[profile].isModified),
	m_ui(new Ui::KeyboardProfileDialog)
{
	m_ui->setupUi(this);

	QStandardItemModel *model(new QStandardItemModel(this));
	const QVector<ActionsManager::ActionDefinition> definitions(ActionsManager::getActionDefinitions());
	for (int i = 0; i < definitions.count(); ++i)
	{
		QStandardItem *item(new QStandardItem(definitions.at(i).icon, QCoreApplication::translate("actions", (definitions.at(i).description.isEmpty() ? definitions.at(i).text : definitions.at(i).description).toUtf8().constData())));
		item->setData(definitions.at(i).identifier, Qt::UserRole);
		item->setToolTip(ActionsManager::getActionName(definitions.at(i).identifier));
		item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemNeverHasChildren);

		if (profiles[profile].shortcuts.contains(definitions.at(i).identifier))
		{
			QStringList shortcuts;

			for (int j = 0; j < profiles[profile].shortcuts[definitions.at(i).identifier].count(); ++j)
			{
				shortcuts.append(profiles[profile].shortcuts[definitions.at(i).identifier].at(j).toString());
			}

			item->setData(shortcuts.join(QLatin1Char(' ')), (Qt::UserRole + 1));
		}

		model->appendRow(item);
	}

	model->setHorizontalHeaderLabels(QStringList({tr("Action")}));
	model->sort(0);

	m_ui->actionsViewWidget->setModel(model);
	m_ui->shortcutsViewWidget->setModel(new QStandardItemModel(this));
	m_ui->shortcutsViewWidget->setItemDelegate(new KeyboardShortcutDelegate(this));
	m_ui->titleLineEdit->setText(profiles[profile].title);
	m_ui->descriptionLineEdit->setText(profiles[profile].description);
	m_ui->versionLineEdit->setText(profiles[profile].version);
	m_ui->authorLineEdit->setText(profiles[profile].author);

	connect(m_ui->filterLineEdit, SIGNAL(textChanged(QString)), m_ui->actionsViewWidget, SLOT(setFilterString(QString)));
	connect(m_ui->actionsViewWidget, SIGNAL(needsActionsUpdate()), this, SLOT(updateActionsActions()));
	connect(m_ui->shortcutsViewWidget, SIGNAL(needsActionsUpdate()), this, SLOT(updateShortcutsActions()));
	connect(m_ui->addShortcutButton, SIGNAL(clicked()), this, SLOT(addShortcut()));
	connect(m_ui->removeShortcutButton, SIGNAL(clicked()), this, SLOT(removeShortcut()));
}
示例#2
0
void ShortcutSetting::setupViews()
{
    table = ui->tableWidget;
    table->setColumnCount(2);

    QStringList headers;
    headers << tr("Function") << tr("Key Sequence");
    table->setHorizontalHeaderLabels(headers);

    label = ui->label;

    lineEdit = ui->lineEdit;
    lineEdit->setContextMenuPolicy(Qt::NoContextMenu);
    QSize size = QSize(lineEdit->sizeHint().height(),
                       lineEdit->sizeHint().height());

    button = new QPushButton(this);
    button->setIcon(QIcon(":/Delete2"));
    button->setFixedSize(size);
    button->setFocusPolicy(Qt::NoFocus);    // Otherwise if get focus, it will show a rect round button.
    button->setFlat(true);
    button->setCursor(QCursor(Qt::PointingHandCursor));
    connect(button, SIGNAL(clicked()), SLOT(removeShortcut()));

    const int RightMargin = 8;
    QHBoxLayout *buttonLayout = new QHBoxLayout();
    buttonLayout->setContentsMargins(0, 0, 0, 0);
    buttonLayout->addStretch();
    buttonLayout->addWidget(button);
    buttonLayout->addSpacing(RightMargin);
    lineEdit->setLayout(buttonLayout);

    // Setting the input rect, protects the text from covered by the button.
    lineEdit->setTextMargins(0, 1, size.width() + RightMargin, 1);
    lineEdit->installEventFilter(this);


    label->setEnabled(false);
    lineEdit->setEnabled(false);
    button->hide();


    QDialogButtonBox *buttonBox = ui->buttonBox;
    QPushButton *button = buttonBox->addButton(QDialogButtonBox::Close);
    connect(button, SIGNAL(clicked()), SIGNAL(clickClose()));
}
示例#3
0
ShortcutPopup::ShortcutPopup()
	: Dialog(TApp::instance()->getMainWindow(), false, false, "Shortcut")
{
	setWindowTitle(tr("Configure Shortcuts"));

	m_list = new ShortcutTree(this);
	m_list->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	m_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	m_list->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);

	m_sViewer = new ShortcutViewer(this);
	m_removeBtn = new QPushButton(tr("Remove"), this);

	m_topLayout->setMargin(5);
	m_topLayout->setSpacing(8);
	{
		m_topLayout->addWidget(m_list, 1);

		QHBoxLayout *bottomLayout = new QHBoxLayout();
		bottomLayout->setMargin(0);
		bottomLayout->setSpacing(1);
		{
			bottomLayout->addWidget(m_sViewer, 1);
			bottomLayout->addWidget(m_removeBtn, 0);
		}
		m_topLayout->addLayout(bottomLayout, 0);
	}

	connect(
		m_list, SIGNAL(actionSelected(QAction *)),
		m_sViewer, SLOT(setAction(QAction *)));

	connect(
		m_removeBtn, SIGNAL(clicked()),
		m_sViewer, SLOT(removeShortcut()));

	connect(
		m_sViewer, SIGNAL(shortcutChanged()),
		m_list, SLOT(onShortcutChanged()));
}
示例#4
0
TagsEditDialog::TagsEditDialog(QWidget *parent, State *stateToEdit, bool addNewTag)
        : KDialog(parent)
        ,  m_loading(false)
{
    // KDialog options
    setCaption(i18n("Customize Tags"));
    setButtons(Ok | Cancel);
    setDefaultButton(Ok);
    setObjectName("CustomizeTags");
    setModal(true);
    showButtonSeparator(true);
    connect(this, SIGNAL(okClicked()), SLOT(slotOk()));
    connect(this, SIGNAL(cancelClicked()), SLOT(slotCancel()));

    setMainWidget(new QWidget(this));

    QHBoxLayout *layout = new QHBoxLayout(mainWidget());

    /* Left part: */

    QPushButton *newTag     = new QPushButton(i18n("Ne&w Tag"),   mainWidget());
    QPushButton *newState   = new QPushButton(i18n("New St&ate"), mainWidget());

    connect(newTag,   SIGNAL(clicked()), this, SLOT(newTag()));
    connect(newState, SIGNAL(clicked()), this, SLOT(newState()));

    m_tags = new TagListView(mainWidget());
    m_tags->header()->hide();
    m_tags->setRootIsDecorated(false);
    //m_tags->addColumn("");
    //m_tags->setSorting(-1); // Sort column -1, so disabled sorting
    //m_tags->setResizeMode(QTreeWidget::LastColumn);

    m_moveUp    = new KPushButton(KGuiItem("", "arrow-up"),   mainWidget());
    m_moveDown  = new KPushButton(KGuiItem("", "arrow-down"), mainWidget());
    m_deleteTag = new KPushButton(KGuiItem("", "edit-delete"), mainWidget());

    m_moveUp->setToolTip(i18n("Move Up (Ctrl+Shift+Up)"));
    m_moveDown->setToolTip(i18n("Move Down (Ctrl+Shift+Down)"));
    m_deleteTag->setToolTip(i18n("Delete"));

    connect(m_moveUp,    SIGNAL(clicked()), this, SLOT(moveUp()));
    connect(m_moveDown,  SIGNAL(clicked()), this, SLOT(moveDown()));
    connect(m_deleteTag, SIGNAL(clicked()), this, SLOT(deleteTag()));

    QHBoxLayout *topLeftLayout = new QHBoxLayout;
    topLeftLayout->addWidget(m_moveUp);
    topLeftLayout->addWidget(m_moveDown);
    topLeftLayout->addWidget(m_deleteTag);

    QVBoxLayout *leftLayout = new QVBoxLayout;
    leftLayout->addWidget(newTag);
    leftLayout->addWidget(newState);
    leftLayout->addWidget(m_tags);
    leftLayout->addLayout(topLeftLayout);

    layout->addLayout(leftLayout);

    /* Right part: */

    QWidget *rightWidget = new QWidget(mainWidget());

    m_tagBox             = new QGroupBox(i18n("Tag"), rightWidget);
    m_tagBoxLayout       = new QHBoxLayout;
    m_tagBox->setLayout(m_tagBoxLayout);

    QWidget   *tagWidget = new QWidget;
    m_tagBoxLayout->addWidget(tagWidget);

    m_tagName = new QLineEdit(tagWidget);
    QLabel *tagNameLabel = new QLabel(i18n("&Name:"), tagWidget);
    tagNameLabel->setBuddy(m_tagName);

    m_shortcut = new KShortcutWidget(tagWidget);
    m_removeShortcut = new QPushButton(i18nc("Remove tag shortcut", "&Remove"), tagWidget);
    QLabel *shortcutLabel = new QLabel(i18n("S&hortcut:"), tagWidget);
    shortcutLabel->setBuddy(m_shortcut);
    //connect( m_shortcut,       SIGNAL(shortcutChanged(const KShortcut&)), this, SLOT(capturedShortcut(const KShortcut&)) );
    connect(m_removeShortcut, SIGNAL(clicked()),                          this, SLOT(removeShortcut()));

    m_inherit = new QCheckBox(i18n("&Inherited by new sibling notes"), tagWidget);

    QGridLayout *tagGrid = new QGridLayout(tagWidget);
    tagGrid->addWidget(tagNameLabel, 0, 0);
    tagGrid->addWidget(m_tagName, 0, 1, 1, 3);
    tagGrid->addWidget(shortcutLabel, 1, 0);
    tagGrid->addWidget(m_shortcut, 1, 1);
    tagGrid->addWidget(m_removeShortcut, 1, 2);
    tagGrid->addWidget(m_inherit, 2, 0, 1, 4);
    tagGrid->setColumnStretch(/*col=*/3, /*stretch=*/255);

    m_stateBox           = new QGroupBox(i18n("State"), rightWidget);
    m_stateBoxLayout = new QHBoxLayout;
    m_stateBox->setLayout(m_stateBoxLayout);

    QWidget *stateWidget = new QWidget;
    m_stateBoxLayout->addWidget(stateWidget);

    m_stateName = new QLineEdit(stateWidget);
    m_stateNameLabel = new QLabel(i18n("Na&me:"), stateWidget);
    m_stateNameLabel->setBuddy(m_stateName);

    QWidget *emblemWidget = new QWidget(stateWidget);
    m_emblem = new KIconButton(emblemWidget);
    m_emblem->setIconType(KIconLoader::NoGroup, KIconLoader::Action);
    m_emblem->setIconSize(16);
    m_emblem->setIcon("edit-delete");
    m_removeEmblem = new QPushButton(i18nc("Remove tag emblem", "Remo&ve"), emblemWidget);
    QLabel *emblemLabel = new QLabel(i18n("&Emblem:"), stateWidget);
    emblemLabel->setBuddy(m_emblem);
    connect(m_removeEmblem, SIGNAL(clicked()), this, SLOT(removeEmblem()));   // m_emblem.resetIcon() is not a slot!

    // Make the icon button and the remove button the same height:
    int height = qMax(m_emblem->sizeHint().width(), m_emblem->sizeHint().height());
    height = qMax(height, m_removeEmblem->sizeHint().height());
    m_emblem->setFixedSize(height, height); // Make it square
    m_removeEmblem->setFixedHeight(height);
    m_emblem->resetIcon();

    QHBoxLayout *emblemLayout = new QHBoxLayout(emblemWidget);
    emblemLayout->addWidget(m_emblem);
    emblemLayout->addWidget(m_removeEmblem);
    emblemLayout->addStretch();

    m_backgroundColor = new KColorCombo2(QColor(), palette().color(QPalette::Base), stateWidget);
    QLabel *backgroundColorLabel = new QLabel(i18n("&Background:"), stateWidget);
    backgroundColorLabel->setBuddy(m_backgroundColor);

    QHBoxLayout *backgroundColorLayout = new QHBoxLayout(0);
    backgroundColorLayout->addWidget(m_backgroundColor);
    backgroundColorLayout->addStretch();

    //QIcon boldIconSet = KIconLoader::global()->loadIconSet("format-text-bold", KIconLoader::Small);
    KIcon boldIconSet("format-text-bold", KIconLoader::global());
    m_bold = new QPushButton(boldIconSet, "", stateWidget);
    m_bold->setCheckable(true);
    int size = qMax(m_bold->sizeHint().width(), m_bold->sizeHint().height());
    m_bold->setFixedSize(size, size); // Make it square!
    m_bold->setToolTip(i18n("Bold"));

    //QIcon underlineIconSet = KIconLoader::global()->loadIconSet("format-text-underline", KIconLoader::Small);
    KIcon underlineIconSet("format-text-underline", KIconLoader::global());
    m_underline = new QPushButton(underlineIconSet, "", stateWidget);
    m_underline->setCheckable(true);
    m_underline->setFixedSize(size, size); // Make it square!
    m_underline->setToolTip(i18n("Underline"));

    //QIcon italicIconSet = KIconLoader::global()->loadIconSet("format-text-italic", KIconLoader::Small);
    KIcon italicIconSet("format-text-italic", KIconLoader::global());
    m_italic = new QPushButton(italicIconSet, "", stateWidget);
    m_italic->setCheckable(true);
    m_italic->setFixedSize(size, size); // Make it square!
    m_italic->setToolTip(i18n("Italic"));

    KIcon strikeIconSet("format-text-strikethrough", KIconLoader::global());
    m_strike = new QPushButton(strikeIconSet, "", stateWidget);
    m_strike->setCheckable(true);
    m_strike->setFixedSize(size, size); // Make it square!
    m_strike->setToolTip(i18n("Strike Through"));

    QLabel *textLabel = new QLabel(i18n("&Text:"), stateWidget);
    textLabel->setBuddy(m_bold);

    QHBoxLayout *textLayout = new QHBoxLayout;
    textLayout->addWidget(m_bold);
    textLayout->addWidget(m_underline);
    textLayout->addWidget(m_italic);
    textLayout->addWidget(m_strike);
    textLayout->addStretch();

    m_textColor = new KColorCombo2(QColor(), palette().color(QPalette::Text), stateWidget);
    QLabel *textColorLabel = new QLabel(i18n("Co&lor:"), stateWidget);
    textColorLabel->setBuddy(m_textColor);

    m_font = new QFontComboBox(stateWidget);
    m_font->addItem(i18n("(Default)"), 0);
    QLabel *fontLabel = new QLabel(i18n("&Font:"), stateWidget);
    fontLabel->setBuddy(m_font);

    m_fontSize = new FontSizeCombo(/*rw=*/true, /*withDefault=*/true, stateWidget);
    QLabel *fontSizeLabel = new QLabel(i18n("&Size:"), stateWidget);
    fontSizeLabel->setBuddy(m_fontSize);

    m_textEquivalent = new QLineEdit(stateWidget);
    QLabel *textEquivalentLabel = new QLabel(i18n("Te&xt equivalent:"), stateWidget);
    textEquivalentLabel->setBuddy(m_textEquivalent);
    QFont font = m_textEquivalent->font();
    font.setFamily("monospace");
    m_textEquivalent->setFont(font);

    HelpLabel *textEquivalentHelp = new HelpLabel(
        i18n("What is this for?"),
        "<p>" + i18n("When you copy and paste or drag and drop notes to a text editor, this text will be inserted as a textual equivalent of the tag.") + "</p>" +
//      "<p>" + i18n("If filled, this property lets you paste this tag or this state as textual equivalent.") + "<br>" +
        i18n("For instance, a list of notes with the <b>To Do</b> and <b>Done</b> tags are exported as lines preceded by <b>[ ]</b> or <b>[x]</b>, "
             "representing an empty checkbox and a checked box.") + "</p>" +
        "<p align='center'><img src=\":images/tag_export_help.png\"></p>",
        stateWidget);
    QHBoxLayout *textEquivalentHelpLayout = new QHBoxLayout;
    textEquivalentHelpLayout->addWidget(textEquivalentHelp);
    textEquivalentHelpLayout->addStretch(255);

    m_onEveryLines = new QCheckBox(i18n("On ever&y line"), stateWidget);

    HelpLabel *onEveryLinesHelp = new HelpLabel(
        i18n("What does this mean?"),
        "<p>" + i18n("When a note has several lines, you can choose to export the tag or the state on the first line or on every line of the note.") + "</p>" +
        "<p align='center'><img src=\":images/tag_export_on_every_lines_help.png\"></p>" +
        "<p>" + i18n("In the example above, the tag of the top note is only exported on the first line, while the tag of the bottom note is exported on every line of the note."),
        stateWidget);
    QHBoxLayout *onEveryLinesHelpLayout = new QHBoxLayout;
    onEveryLinesHelpLayout->addWidget(onEveryLinesHelp);
    onEveryLinesHelpLayout->addStretch(255);

    QGridLayout *textEquivalentGrid = new QGridLayout;
    textEquivalentGrid->addWidget(textEquivalentLabel,      0, 0);
    textEquivalentGrid->addWidget(m_textEquivalent,         0, 1);
    textEquivalentGrid->addLayout(textEquivalentHelpLayout, 0, 2);
    textEquivalentGrid->addWidget(m_onEveryLines,           1, 1);
    textEquivalentGrid->addLayout(onEveryLinesHelpLayout,   1, 2);
    textEquivalentGrid->setColumnStretch(/*col=*/3, /*stretch=*/255);

    KSeparator *separator = new KSeparator(Qt::Horizontal, stateWidget);

    QGridLayout *stateGrid = new QGridLayout(stateWidget);
    stateGrid->addWidget(m_stateNameLabel, 0, 0);
    stateGrid->addWidget(m_stateName, 0, 1, 1, 6);
    stateGrid->addWidget(emblemLabel, 1, 0);
    stateGrid->addWidget(emblemWidget, 1, 1, 1, 6);
    stateGrid->addWidget(backgroundColorLabel, 1, 5);
    stateGrid->addLayout(backgroundColorLayout, 1, 6, 1, 1);
    stateGrid->addWidget(textLabel, 2, 0);
    stateGrid->addLayout(textLayout, 2, 1, 1, 4);
    stateGrid->addWidget(textColorLabel, 2, 5);
    stateGrid->addWidget(m_textColor, 2, 6);
    stateGrid->addWidget(fontLabel, 3, 0);
    stateGrid->addWidget(m_font, 3, 1, 1, 4);
    stateGrid->addWidget(fontSizeLabel, 3, 5);
    stateGrid->addWidget(m_fontSize, 3, 6);
    stateGrid->addWidget(separator, 4, 0, 1, 7);
    stateGrid->addLayout(textEquivalentGrid, 5, 0, 1, 7);

    QVBoxLayout *rightLayout = new QVBoxLayout(rightWidget);
    rightLayout->addWidget(m_tagBox);
    rightLayout->addWidget(m_stateBox);
    rightLayout->addStretch();

    layout->addWidget(rightWidget);
    rightWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);

    // Equalize the width of the first column of the two grids:
    int maxWidth = tagNameLabel->sizeHint().width();
    maxWidth = qMax(maxWidth, shortcutLabel->sizeHint().width());
    maxWidth = qMax(maxWidth, m_stateNameLabel->sizeHint().width());
    maxWidth = qMax(maxWidth, emblemLabel->sizeHint().width());
    maxWidth = qMax(maxWidth, textLabel->sizeHint().width());
    maxWidth = qMax(maxWidth, fontLabel->sizeHint().width());
    maxWidth = qMax(maxWidth, backgroundColorLabel->sizeHint().width());
    maxWidth = qMax(maxWidth, textEquivalentLabel->sizeHint().width());

    tagNameLabel->setFixedWidth(maxWidth);
    m_stateNameLabel->setFixedWidth(maxWidth);
    textEquivalentLabel->setFixedWidth(maxWidth);

    // Load Tags:
    for (Tag::List::iterator tagIt = Tag::all.begin(); tagIt != Tag::all.end(); ++tagIt)
        m_tagCopies.append(new TagCopy(*tagIt));

    TagListViewItem *lastInsertedItem = 0;
    TagListViewItem *lastInsertedSubItem;
    TagListViewItem *item;
    TagListViewItem *subItem;
    for (TagCopy::List::iterator tagCopyIt = m_tagCopies.begin(); tagCopyIt != m_tagCopies.end(); ++tagCopyIt) {
        // New List View Item:
        if (lastInsertedItem)
            item = new TagListViewItem(m_tags, lastInsertedItem, *tagCopyIt);
        else
            item = new TagListViewItem(m_tags, *tagCopyIt);
        item->setExpanded(true);
        lastInsertedItem = item;
        // Load
        if ((*tagCopyIt)->isMultiState()) {
            lastInsertedSubItem = 0;
            StateCopy::List stateCopies = item->tagCopy()->stateCopies;
            for (StateCopy::List::iterator stateCopyIt = stateCopies.begin(); stateCopyIt != stateCopies.end(); ++stateCopyIt) {
                if (lastInsertedSubItem)
                    subItem = new TagListViewItem(item, lastInsertedSubItem, *stateCopyIt);
                else
                    subItem = new TagListViewItem(item, *stateCopyIt);
                lastInsertedSubItem = subItem;
            }
        }
    }

    // Connect Signals:
    connect(m_tagName,         SIGNAL(textChanged(const QString&)),        this, SLOT(modified()));
    connect(m_shortcut,        SIGNAL(shortcutChanged(const KShortcut&)), this, SLOT(modified()));
    connect(m_inherit,         SIGNAL(stateChanged(int)),                  this, SLOT(modified()));
    connect(m_stateName,       SIGNAL(textChanged(const QString&)),        this, SLOT(modified()));
    connect(m_emblem,          SIGNAL(iconChanged(QString)),               this, SLOT(modified()));
    connect(m_backgroundColor, SIGNAL(activated(const QColor&)),             this, SLOT(modified()));
    connect(m_bold,            SIGNAL(toggled(bool)),                      this, SLOT(modified()));
    connect(m_underline,       SIGNAL(toggled(bool)),                      this, SLOT(modified()));
    connect(m_italic,          SIGNAL(toggled(bool)),                      this, SLOT(modified()));
    connect(m_strike,          SIGNAL(toggled(bool)),                      this, SLOT(modified()));
    connect(m_textColor,       SIGNAL(activated(const QColor&)),             this, SLOT(modified()));
    connect(m_font,            SIGNAL(textChanged(const QString&)),        this, SLOT(modified()));
    connect(m_fontSize,        SIGNAL(textChanged(const QString&)),        this, SLOT(modified()));
    connect(m_textEquivalent,  SIGNAL(textChanged(const QString&)),        this, SLOT(modified()));
    connect(m_onEveryLines,    SIGNAL(stateChanged(int)),                  this, SLOT(modified()));

    connect(m_tags,            SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),     this,
            SLOT(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
    connect(m_tags,            SIGNAL(deletePressed()),                    this, SLOT(deleteTag()));
    connect(m_tags,            SIGNAL(doubleClickedItem()),                this, SLOT(renameIt()));

    QTreeWidgetItem *firstItem = m_tags->firstChild();
    if (stateToEdit != 0) {
        TagListViewItem *item = itemForState(stateToEdit);
        if (item)
            firstItem = item;
    }
    // Select the first tag unless the first tag is a multi-state tag.
    // In this case, select the first state, as it let customize the state AND the associated tag.
    if (firstItem) {
        if (firstItem->childCount() > 0)
            firstItem = firstItem->child(0);
        firstItem->setSelected(true);
        m_tags->setCurrentItem(firstItem);
        currentItemChanged(firstItem);
        if (stateToEdit == 0)
            m_tags->scrollToItem(firstItem);
        m_tags->setFocus();
    } else {
        m_moveUp->setEnabled(false);
        m_moveDown->setEnabled(false);
        m_deleteTag->setEnabled(false);
        m_tagBox->setEnabled(false);
        m_stateBox->setEnabled(false);
    }
    // TODO: Disabled both boxes if no tag!!!

    // Some keyboard shortcuts:       // Ctrl+arrows instead of Alt+arrows (same as Go menu in the main window) because Alt+Down is for combo boxes
    QAction *selectAbove = new QAction(this);
    selectAbove->setShortcut(Qt::CTRL + Qt::Key_Up);
    connect(selectAbove, SIGNAL(activated()), this, SLOT(selectUp()));

    QAction *selectBelow = new QAction(this);
    selectBelow->setShortcut(Qt::CTRL + Qt::Key_Down);
    connect(selectBelow, SIGNAL(activated()), this, SLOT(selectDown()));

    QAction *selectLeft = new QAction(this);
    selectLeft->setShortcut(Qt::CTRL + Qt::Key_Left);
    connect(selectLeft, SIGNAL(activated()), this, SLOT(selectLeft()));

    QAction *selectRight = new QAction(this);
    selectRight->setShortcut(Qt::CTRL + Qt::Key_Right);
    connect(selectRight, SIGNAL(activated()), this, SLOT(selectRight()));

    QAction *moveAbove = new QAction(this);
    moveAbove->setShortcut(Qt::CTRL + Qt::Key_Up);
    connect(moveAbove, SIGNAL(activated()), this, SLOT(moveUp()));

    QAction *moveBelow = new QAction(this);
    moveBelow->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Down);
    connect(moveBelow, SIGNAL(activated()), this, SLOT(moveDown()));

    QAction *rename = new QAction(this);
    rename->setShortcut(Qt::Key_F2);
    connect(rename, SIGNAL(activated()), this, SLOT(renameIt()));

    m_tags->setMinimumSize(
        m_tags->sizeHint().width() * 2,
        m_tagBox->sizeHint().height() + m_stateBox->sizeHint().height()
    );

    if (addNewTag)
        QTimer::singleShot(0, this, SLOT(newTag()));
    else
        // Once the window initial size is computed and the window show, allow the user to resize it down:
        QTimer::singleShot(0, this, SLOT(resetTreeSizeHint()));
}