示例#1
0
AppletInterface::AppletInterface(SimpleJavaScriptApplet *parent)
    : QObject(parent),
      m_appletScriptEngine(parent),
      m_actionSignals(0)
{
    connect(this, SIGNAL(releaseVisualFocus()), applet(), SIGNAL(releaseVisualFocus()));
    connect(this, SIGNAL(configNeedsSaving()), applet(), SIGNAL(configNeedsSaving()));
}
示例#2
0
AppletInterface::AppletInterface(AbstractJsAppletScript *parent)
    : QObject(parent),
      m_appletScriptEngine(parent),
      m_actionSignals(0)
{
    connect(this, SIGNAL(releaseVisualFocus()), applet(), SIGNAL(releaseVisualFocus()));
    connect(this, SIGNAL(configNeedsSaving()), applet(), SIGNAL(configNeedsSaving()));
    connect(applet(), SIGNAL(immutabilityChanged(Plasma::ImmutabilityType)), this, SIGNAL(immutableChanged()));
    connect(applet(), SIGNAL(newStatus(Plasma::ItemStatus)), this, SIGNAL(statusChanged()));
    connect(m_appletScriptEngine, SIGNAL(formFactorChanged()),
            this, SIGNAL(formFactorChanged()));
    connect(m_appletScriptEngine, SIGNAL(locationChanged()),
            this, SIGNAL(locationChanged()));
    connect(m_appletScriptEngine, SIGNAL(contextChanged()),
            this, SIGNAL(contextChanged()));
}
示例#3
0
void Hdd::configAccepted()
{
    KConfigGroup cg = config();
    KConfigGroup cgGlobal = globalConfig();
    QStandardItem *parentItem = m_hddModel.invisibleRootItem();

    clear();

    for (int i = 0; i < parentItem->rowCount(); ++i) {
        QStandardItem *item = parentItem->child(i, 0);
        if (item) {
            QStandardItem *child = parentItem->child(i, 1);
            if (child->text() != child->data().toString()) {
                cgGlobal.writeEntry(item->data().toString(), child->text());
            }
            if (item->checkState() == Qt::Checked) {
                appendSource(item->data().toString());
            }
        }
    }
    cg.writeEntry("uuids", sources());

    uint interval = ui.intervalSpinBox->value();
    cg.writeEntry("interval", interval);

    emit configNeedsSaving();
}
示例#4
0
void IconApplet::init()
{
    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(this);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);

    layout->addItem(m_icon);

    KConfigGroup cg = config();

    if (m_url.isValid()) {
        // we got this in via the ctor, e.g. as a result of a drop
        cg.writeEntry("Url", m_url);
        emit configNeedsSaving();
    } else {
        configChanged();
    }

    setDisplayLines(2);
    registerAsDragHandle(m_icon);
    setAspectRatioMode(Plasma::ConstrainedSquare);

    connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)),
        this, SLOT(iconSizeChanged(int)));
}
示例#5
0
void Paste::configAccepted()
{
    m_snippetConfig->getData(&cfg);
    m_autoPasteConfig->getData(&cfg);
    m_list->setData(cfg);
    cfg.writeEntries();
    emit configNeedsSaving();
}
void GraphicalTimetableLine::configAccepted()
{
    m_stopSettings = m_stopWidget->stopSettings();
    m_vehicleTypes = m_vehicleTypeModel->checkedVehicleTypes();

    qDeleteAll( m_departures );
    m_departures.clear();

    if ( m_stopSettings.stops().isEmpty() ) {
        setConfigurationRequired( true, i18n("Please select a stop name") );
    } else if ( m_stopSettings.get<QString>(ServiceProviderSetting).isEmpty() ) {
        setConfigurationRequired( true, i18n("Please select a service provider") );
    } else {
        setConfigurationRequired( false );
    }

    // Disconnect old source
    if ( !m_sourceName.isEmpty() ) {
        dataEngine("publictransport")->disconnectSource( m_sourceName, this );
    }

    if ( !configurationRequired() ) {
        m_animate = false;
        m_sourceName = QString("Departures %1|stop=%2|timeoffset=0")
                    .arg(m_stopSettings.get<QString>(ServiceProviderSetting))
                    .arg(m_stopSettings.stops(StopSettings::UseStopIdIfAvailable).first());
        dataEngine("publictransport")->connectSource( m_sourceName,
                this, 60000, Plasma::AlignToMinute );
    }

    m_showTimetable = m_showTimetableCheckbox->isChecked();
    m_drawTransportLine = m_drawTransportLineCheckbox->isChecked();

    config().writeEntry( QLatin1String("serviceProvider"),
                         m_stopSettings.get<QString>(ServiceProviderSetting) );
    config().writeEntry( QLatin1String("stopName"),
                         m_stopSettings.stops(StopSettings::UseStopIdIfAvailable).first() );

    config().writeEntry( QLatin1String("timelineLength"), m_timelineLength );
    config().writeEntry( QLatin1String("showTimetable"), m_showTimetable );
    config().writeEntry( QLatin1String("drawTransportLine"), m_drawTransportLine );

    QVariantList vehicleTypes;
    foreach ( VehicleType vehicleType, m_vehicleTypes ) {
        vehicleTypes << static_cast<int>( vehicleType );
    }
    config().writeEntry( QLatin1String("vehicleTypes"), vehicleTypes );

    emit configNeedsSaving();
    configChanged();

    m_stopWidget = 0;
    m_vehicleTypeModel = 0;
    m_showTimetableCheckbox = 0;
    m_drawTransportLineCheckbox = 0;
}
示例#7
0
void Luna::configAccepted()
{
    northHemisphere = ui.northenRadio->isChecked();

    config().writeEntry("northHemisphere", northHemisphere);

    update();

    emit configNeedsSaving();
}
示例#8
0
void SpellCheck::dialogResized()
{
    if (!m_spellingDialog) {
        return;
    }

    config().writeEntry("dialogSize", m_spellingDialog->size());

    emit configNeedsSaving();
}
示例#9
0
void KalziumPlasma::configAccepted()
{
    prepareGeometryChange();

    KConfigGroup cg = config();
    cg.writeEntry("font", m_font);
    m_label1->setFont(m_font);

    emit configNeedsSaving();
}
void EmergingPlasmoid::configAccepted() {
  timeout = configWidget.timeoutSpinBox->value();
  logoPosition = (LogoPosition) configWidget.logoPositionComboBox->currentIndex();
  KConfigGroup conf = config();
  conf.writeEntry("timeout", timeout);
  conf.writeEntry("logoPosition", (int) logoPosition);
  conf.sync();
  
  setupLayout();
  configDialog->enableButtonApply(false);
  emit configNeedsSaving();
}
示例#11
0
void SpellCheck::setLanguage(const QString &language)
{
    if (language != m_textEdit->spellCheckingLanguage()) {
        m_textEdit->setSpellCheckingLanguage(language);
    }

    m_dictionaryComboBox->setCurrentByDictionary(language);

    config().writeEntry("dictionary", language);

    emit configNeedsSaving();
}
示例#12
0
文件: simonoid.cpp 项目: KDE/simon
void Simonoid::configAccepted() {
  if ( m_configpage ) {
    m_layouttype = ( LayoutType ) m_uiconfig.cb_layout->currentIndex();
    m_interval = m_uiconfig.ni_interval->value();
  }

  m_checkConnectionTimer.setInterval ( 1000*m_interval );

  initLayout ( m_layouttype );

  update();
  emit configNeedsSaving();
  m_configpage->deleteLater();
}
示例#13
0
void WicdApplet::configAccepted()
{
    KConfigGroup cg = config();

    if (m_showSignalStrength != ui.displayqualityBox->isChecked()) {
        cg.writeEntry("Show signal strength", !m_showSignalStrength);
    }
    if (m_autoScan != ui.autoscanBox->isChecked()) {
        cg.writeEntry("Autoscan", !m_autoScan);
    }
    if (m_showPlotter != ui.plotterBox->isChecked()) {
        cg.writeEntry("Show plotter", !m_showPlotter);
    }

    emit configNeedsSaving();
}
示例#14
0
void IconApplet::constraintsEvent(Plasma::Constraints constraints)
{
    setBackgroundHints(NoBackground);

    if (constraints & Plasma::FormFactorConstraint) {
        disconnect(m_icon, SIGNAL(activated()), this, SLOT(openUrl()));
        disconnect(m_icon, SIGNAL(clicked()), this, SLOT(openUrl()));

        if (formFactor() == Plasma::Planar || formFactor() == Plasma::MediaCenter) {
            connect(m_icon, SIGNAL(activated()), this, SLOT(openUrl()));

            if (!m_lastFreeSize.isEmpty()) {
                resize(m_lastFreeSize);
            }

            m_icon->setText(m_text);
            Plasma::ToolTipManager::self()->unregisterWidget(m_icon);
            m_icon->setDrawBackground(true);
        } else {
            //in the panel the icon behaves like a button
            connect(m_icon, SIGNAL(clicked()), this, SLOT(openUrl()));
            m_icon->setText(QString());
            Plasma::ToolTipContent data(m_text, m_genericName, m_icon->icon());
            Plasma::ToolTipManager::self()->setContent(m_icon, data);
            m_icon->setDrawBackground(false);

            if (!m_lastFreeSize.isEmpty()) {
                config().writeEntry("LastFreeSize", size().toSize());
                emit configNeedsSaving();
            }
        }
    }

    if (constraints & Plasma::SizeConstraint && !m_lastFreeSize.isEmpty() &&
        (formFactor() == Plasma::Planar || formFactor() == Plasma::MediaCenter)) {
        m_lastFreeSize = size().toSize();
    }

    if (constraints & Plasma::StartupCompletedConstraint) {
        m_lastFreeSize = config().readEntry("LastFreeSize", size().toSize());
    }
}
示例#15
0
void Clock::clockConfigAccepted()
{
    KConfigGroup cg = config();
    m_showTimezoneString = ui.showTimezoneStringCheckBox->isChecked();
    m_showingTimezone = m_showTimezoneString || shouldDisplayTimezone();
    m_showSecondHand = ui.showSecondHandCheckBox->isChecked();

    if (m_showSecondHand) {
        //We don't need to cache the applet if it update every seconds
        setCacheMode(QGraphicsItem::NoCache);
    } else {
        setCacheMode(QGraphicsItem::DeviceCoordinateCache);
    }

    cg.writeEntry("showSecondHand", m_showSecondHand);
    cg.writeEntry("showTimezoneString", m_showTimezoneString);
    update();

    dataEngine("time")->disconnectSource(currentTimezone(), this);
    connectToEngine();

    constraintsEvent(Plasma::AllConstraints);
    emit configNeedsSaving();
}
示例#16
0
void DateTimeGroup::configAccepted()
{
	bool m_formatChanged;
	KConfigGroup cg = config();
	
	if (m_isDefaultFont && ui.plainDateTimeGroupFont->currentFont() != m_plainDateTimeGroupFont) {
		m_isDefaultFont = false;
	}
	
	m_plainDateTimeGroupFont = ui.plainDateTimeGroupFont->currentFont();
	
	if(m_sAfterDay!=ui.sAfterDay->isChecked()){
		m_sAfterDay = !m_sAfterDay;
		cg.writeEntry("sAfterDay", m_sAfterDay);
		m_formatChanged=true;
	}
	if(m_sAfterHour!=ui.sAfterHour->isChecked()){
		m_sAfterHour = !m_sAfterHour;
		cg.writeEntry("sAfterHour", m_sAfterHour);
		m_formatChanged=true;
	}
	
	if(m_sAfterMinute!=ui.sAfterMinute->isChecked()){
		m_sAfterMinute =!m_sAfterMinute;
		cg.writeEntry("sAfterMinute", m_sAfterMinute);	
		m_formatChanged=true;
	}
	
	if(m_sAfterSecond!=ui.sAfterSecond->isChecked()){
		m_sAfterSecond =!m_sAfterSecond;
		cg.writeEntry("sAfterSecond", m_sAfterSecond);
		m_formatChanged=true;
	}
	
	if(m_sAfterTimeZone!=ui.sAfterTimeZone->isChecked()){
		m_sAfterTimeZone = !m_sAfterTimeZone;
		cg.writeEntry("sAfterTimeZone", m_sAfterTimeZone);
		m_formatChanged=true;
	}
	
	if(m_sAfterMonth!=ui.sAfterMonth->isChecked()){
		m_sAfterMonth = !m_sAfterMonth;
		cg.writeEntry("sAfterMonth", m_sAfterMonth);
		m_formatChanged=true;
	}
	if(m_rounded!=timezonesUi.fullLetters->isChecked()){
		m_rounded = !m_rounded;
		cg.writeEntry("rounded", m_rounded);
		m_formatChanged=true;
	}
	
	if(m_natoOperation!= ui.natoOperation->isChecked()){
		m_natoOperation=!m_natoOperation;
		cg.writeEntry("natoOperation", m_natoOperation);
		tzBefNatoOp=cg.readEntry("currentTimezone");
		changeEngineTimezone( (m_natoOperation?"UTC":tzBefNatoOp)); 
	}

	if(m_local!= ui.localTime->isChecked()){
		m_local=!m_local;
		cg.writeEntry("localTime", m_local);
		tzBefNatoOp=m_natoOperation?"UTC":cg.readEntry("currentTimezone");
		changeEngineTimezone( (m_local?"Local":tzBefNatoOp)); 
	}
	if (timezonesUi.timeZones->selection()!=curtz && !m_local && !m_natoOperation) {
		changeEngineTimezone(timezonesUi.timeZones->selection());
		cg.writeEntry("currentTimezone", timezonesUi.timeZones->selection());
	}
	if(ui.shortFormat->isChecked()&&m_format!=1){
		int oldm_format=m_format;
		m_format=1;
		m_formatChanged=false;
		if(oldm_format==0)
			setDtg(dataEngine("datetimegroup")->query(currentTimezone()));
	}
	else if(ui.longFormat->isChecked()&&m_format!=2){
		m_format=2;
	}
	else if(ui.stanFormat->isChecked()&&m_format!=0){
		int oldm_format=m_format;
		m_format=0;
		m_formatChanged=false;
		if(oldm_format==1)
			setDtg(dataEngine("datetimegroup")->query(currentTimezone()));
	}
	
	cg.writeEntry("format",m_format);
	if (m_showSeconds != (m_format==2)) {
		m_showSeconds = !m_showSeconds;
		
		if (m_showSeconds) {
			//We don't need to cache the applet if it update every second
			setCacheMode(QGraphicsItem::NoCache);
		} else {
			setCacheMode(QGraphicsItem::DeviceCoordinateCache);
		}
		
		changeEngineTimezone(currentTimezone());
	}
	if(m_formatChanged)
		setDtg(dataEngine("datetimegroup")->query(currentTimezone()));
		
	m_useCustomColor = ui.useCustomColor->isChecked();
	cg.writeEntry("useCustomColor", m_useCustomColor);
	if (m_useCustomColor) {
		m_plainDateTimeGroupColor = ui.plainDateTimeGroupColor->color();
		cg.writeEntry("plainDateTimeGroupColor", m_plainDateTimeGroupColor);
		m_pixmap = QPixmap();
		delete m_svg;
		m_svg = 0;
	} else {
		m_plainDateTimeGroupColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
	}
	
	m_useCustomShadowColor = ui.useCustomShadowColor->isChecked();
	cg.writeEntry("useCustomShadowColor", m_useCustomShadowColor);
	if (m_useCustomShadowColor) {
		m_plainDateTimeGroupShadowColor = ui.plainDateTimeGroupShadowColor->color();
		cg.writeEntry("plainDateTimeGroupShadowColor", m_plainDateTimeGroupShadowColor);
	} else {
		m_plainDateTimeGroupShadowColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
	}
	m_drawShadow = ui.drawShadow->isChecked();
	cg.writeEntry("plainDateTimeGroupDrawShadow", m_drawShadow);
	
	m_plainDateTimeGroupFont.setBold(ui.plainDateTimeGroupFontBold->checkState() == Qt::Checked);
	m_plainDateTimeGroupFont.setItalic(ui.plainDateTimeGroupFontItalic->checkState() == Qt::Checked);
	cg.writeEntry("plainDateTimeGroupFont", m_plainDateTimeGroupFont);
	
	constraintsEvent(Plasma::SizeConstraint);
	generatePixmap();
	update();
	
	emit sizeHintChanged(Qt::PreferredSize);
	emit configNeedsSaving();
}
示例#17
0
void KdeObservatory::saveConfig()
{
    // General properties
    KConfigGroup configGroup = config();

    configGroup.writeEntry("activityRangeType", m_activityRangeType);
    configGroup.writeEntry("commitExtent", m_commitExtent);
    configGroup.writeEntry("commitFrom", m_commitFrom);
    configGroup.writeEntry("commitTo"  , m_commitTo);
    configGroup.writeEntry("enableAutoViewChange", m_enableAutoViewChange);
    configGroup.writeEntry("viewsDelay", m_viewsDelay);

    QStringList viewNames;
    QList<bool> viewActives;

    QListIterator< QPair<QString, bool> > i1(m_activeViews);
    while (i1.hasNext())
    {
        const QPair<QString, bool> &pair = i1.next();
        viewNames << pair.first;
        viewActives << pair.second;
    }
    configGroup.writeEntry("viewNames", viewNames);
    configGroup.writeEntry("viewActives", viewActives);

    // Projects properties
    QStringList projectNames;
    QStringList projectCommitSubjects;
    QStringList projectKrazyReports;
    QStringList projectKrazyFilePrefix;
    QStringList projectIcons;

    QMapIterator<QString, Project> i2(m_projects);
    while (i2.hasNext())
    {
        i2.next();
        const Project &project = i2.value();
        projectNames << i2.key();
        projectCommitSubjects << project.commitSubject;
        projectKrazyReports << project.krazyReport;
        projectKrazyFilePrefix << project.krazyFilePrefix;
        projectIcons << project.icon;
    }

    configGroup.writeEntry("projectNames", projectNames);
    configGroup.writeEntry("projectCommitSubjects", projectCommitSubjects);
    configGroup.writeEntry("projectKrazyReports", projectKrazyReports);
    configGroup.writeEntry("projectKrazyFilePrefix", projectKrazyFilePrefix);
    configGroup.writeEntry("projectIcons", projectIcons);

    configGroup.writeEntry("topActiveProjectsViewNames", m_topActiveProjectsViewProjects.keys());
    configGroup.writeEntry("topActiveProjectsViewActives", m_topActiveProjectsViewProjects.values());

    configGroup.writeEntry("topDevelopersViewNames", m_topDevelopersViewProjects.keys());
    configGroup.writeEntry("topDevelopersViewActives", m_topDevelopersViewProjects.values());

    configGroup.writeEntry("commitHistoryViewNames", m_commitHistoryViewProjects.keys());
    configGroup.writeEntry("commitHistoryViewActives", m_commitHistoryViewProjects.values());

    configGroup.writeEntry("krazyReportViewNames", m_krazyReportViewProjects.keys());
    configGroup.writeEntry("krazyReportViewActives", m_krazyReportViewProjects.values());

    emit configNeedsSaving();
}
示例#18
0
void Clock::clockConfigAccepted()
{
    KConfigGroup cg = config();

    m_showTimezone = ui.showTimeZone->isChecked();
    cg.writeEntry("showTimezone", m_showTimezone);

    if (m_isDefaultFont && ui.plainClockFont->currentFont() != m_plainClockFont) {
        m_isDefaultFont = false;
    }
    m_plainClockFont = ui.plainClockFont->currentFont();

    //We need this to happen before we disconnect/reconnect sources to ensure
    //that the update interval is set properly.
    if (m_showSeconds != ui.secondsCheckbox->isChecked()) {
        m_showSeconds = !m_showSeconds;
        cg.writeEntry("showSeconds", m_showSeconds);

        if (m_showSeconds) {
            //We don't need to cache the applet if it update every second
            setCacheMode(QGraphicsItem::NoCache);
        } else {
            setCacheMode(QGraphicsItem::DeviceCoordinateCache);
        }

        changeEngineTimezone(currentTimezone(), currentTimezone());
    }

    m_dateStyle = ui.dateStyle->currentIndex();
    cg.writeEntry("dateStyle", m_dateStyle);

    m_showSeconds = ui.secondsCheckbox->checkState() == Qt::Checked;
    cg.writeEntry("showSeconds", m_showSeconds);

    m_useCustomColor = ui.useCustomColor->isChecked();
    cg.writeEntry("useCustomColor", m_useCustomColor);
    if (m_useCustomColor) {
        m_plainClockColor = ui.plainClockColor->color();
        cg.writeEntry("plainClockColor", m_plainClockColor);
        m_pixmap = QPixmap();
        delete m_svg;
        m_svg = 0;
    } else {
        m_plainClockColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
    }

    m_useCustomShadowColor = ui.useCustomShadowColor->isChecked();
    cg.writeEntry("useCustomShadowColor", m_useCustomShadowColor);
    if (m_useCustomShadowColor) {
        m_plainClockShadowColor = ui.plainClockShadowColor->color();
        cg.writeEntry("plainClockShadowColor", m_plainClockShadowColor);
    } else {
        m_plainClockShadowColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
    }
    m_drawShadow = ui.drawShadow->isChecked();
    cg.writeEntry("plainClockDrawShadow", m_drawShadow);

    m_plainClockFont.setBold(ui.plainClockFontBold->checkState() == Qt::Checked);
    m_plainClockFont.setItalic(ui.plainClockFontItalic->checkState() == Qt::Checked);
    cg.writeEntry("plainClockFont", m_plainClockFont);

    constraintsEvent(Plasma::SizeConstraint);
    generatePixmap();
    update();
    emit sizeHintChanged(Qt::PreferredSize);
    emit configNeedsSaving();
}