Example #1
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);
}
Example #2
0
void MicroSettingsDlg::slotRemovePinMap()
{
	KComboBox * combo = m_pWidget->pinMapCombo;
	
	QString pinMapID = combo->currentText();
	if ( pinMapID.isEmpty() )
		return;
	
	m_pinMappings.remove( pinMapID );
	combo->removeItem( combo->currentItem() );
	
	updatePinMapButtons();
}