QStringList CMakeBuildDirChooser::extraArgumentsHistory() const
{
    QStringList list;
    KComboBox* extraArguments = m_chooserUi->extraArguments;
    if (!extraArguments->currentText().isEmpty()) {
        list << extraArguments->currentText();
    }
    for (int i = 0; i < qMin(maxExtraArgumentsInHistory, extraArguments->count()); ++i) {
        if (!extraArguments->itemText(i).isEmpty() &&
            (extraArguments->currentText() != extraArguments->itemText(i))) {
            list << extraArguments->itemText(i);
        }
    }
    return list;
}
Пример #2
0
void KBugReportPrivate::_k_appChanged(int i)
{
    QString appName = appcombo->itemText(i);
    int index = appName.indexOf( '/' );
    if ( index > 0 )
        appName = appName.left( index );
    kDebug() << "appName " << appName;

    QString strDisplayVersion; //Version string to show in the UI
    if (appname == appName && m_aboutData) {
        m_strVersion = m_aboutData->version();
        strDisplayVersion = m_strVersion;
    } else {
        m_strVersion = QLatin1String("unknown"); //English string to put in the bug report
        strDisplayVersion = i18nc("unknown program name", "unknown");
    }

    if ( !submitBugWeb ) {
        m_strVersion += ' ' + kde_version;
        strDisplayVersion += ' ' + kde_version;
    }

    m_version->setText(strDisplayVersion);
    if ( submitBugWeb )
        _k_updateUrl();
}
Пример #3
0
void BGDialog::setWallpaper(const QString &s)
{
    KComboBox *comboWallpaper = m_urlWallpaperBox;
    int i = comboWallpaper->count();
    if (i == 0)
        return;
    comboWallpaper->blockSignals(true);

    if (m_wallpaper.find(s) == m_wallpaper.end()) {
        QString imageCaption;
        int slash = s.lastIndexOf('/') + 1;
        int endDot = s.lastIndexOf('.');

        // strip the extension if it exists
        if (endDot != -1 && endDot > slash)
            imageCaption = s.mid(slash, endDot - slash);
        else
            imageCaption = s.mid(slash);
        if (comboWallpaper->itemText(i - 1) == imageCaption) {
            i--;
            comboWallpaper->removeItem(i);
        }
        comboWallpaper->addItem(imageCaption);
        m_wallpaper[s] = i;
        comboWallpaper->setCurrentIndex(i);
    } else {
        comboWallpaper->setCurrentIndex(m_wallpaper[s]);
    }
    comboWallpaper->blockSignals(false);
}
Пример #4
0
void FindFilesDialog::setDirName(const QString &dir)
{
	KComboBox *combo = dir_combo->comboBox();

	if (findListItem(combo, dir) < 0) {
		combo->addItem(dir);
	}
	if (combo->itemText(0) != dir) {
		slotClear();
	}
}
Пример #5
0
void KSelectAction_UnitTest::testChildActionStateChangeComboMode()
{
    KSelectAction selectAction("selectAction", 0);
    selectAction.setToolBarMode(KSelectAction::ComboBoxMode);
    QWidget parent;
    QWidget* widget = selectAction.requestWidget(&parent);
    KComboBox* comboBox = qobject_cast<KComboBox*>(widget);
    QVERIFY(comboBox);
    const QString itemText = "foo";
    KAction* childAction = selectAction.addAction(itemText);
    QCOMPARE(comboBox->itemText(0), itemText);
    childAction->setEnabled(false);
    // There's no API for item-is-enabled, need to go via the internal model like kselectaction does...
    QStandardItemModel *model = qobject_cast<QStandardItemModel *>(comboBox->model());
    QVERIFY(model);
    QVERIFY(!model->item(0)->isEnabled());

    // Now remove the action
    selectAction.removeAction(childAction);
    QCOMPARE(comboBox->count(), 0);
}