~ubuntu-branches/ubuntu/wily/kscreen/wily

« back to all changes in this revision

Viewing changes to kded/daemon.cpp

  • Committer: Package Import Robot
  • Author(s): Scarlett Clark, Scarlett Clark, Jonathan Riddell, Harald Sitter
  • Date: 2014-08-20 08:35:15 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20140820083515-i9lk9nyt0adwd2q5
Tags: 2.0.0~git20141114-0ubuntu1
[ Scarlett Clark ]
* Update packaging for frameworks branch
* Git snapshot of the frameworks branch

[ Jonathan Riddell ]
* Remove kscreen-console.1 manpage which is out of date

[ Harald Sitter ]
* switch to new pkg-kde-tools

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "kscreenadaptor.h"
24
24
 
25
25
#include <QtCore/QTimer>
 
26
#include <QAction>
 
27
#include <QShortcut>
26
28
 
27
 
#include <kdebug.h>
28
 
#include <kdemacros.h>
29
 
#include <kaction.h>
30
29
#include <KLocalizedString>
31
30
#include <KActionCollection>
32
31
#include <KPluginFactory>
 
32
#include <KGlobalAccel>
33
33
 
34
34
#include <kscreen/config.h>
35
35
#include <kscreen/configmonitor.h>
51
51
    }
52
52
 
53
53
    KActionCollection *coll = new KActionCollection(this);
54
 
    KAction* action = coll->addAction("display");
 
54
    QAction* action = coll->addAction(QStringLiteral("display"));
55
55
    action->setText(i18n("Switch Display" ));
56
 
    action->setGlobalShortcut(KShortcut(Qt::Key_Display));
 
56
    KGlobalAccel::self()->setShortcut(action, QList<QKeySequence>() << QKeySequence(Qt::Key_Display));
57
57
 
58
58
    new KScreenAdaptor(this);
59
59
 
89
89
 
90
90
void KScreenDaemon::applyConfig()
91
91
{
92
 
    kDebug() << "Applying config";
 
92
    qDebug() << "Applying config";
93
93
    if (Serializer::configExists()) {
94
94
        applyKnownConfig();
95
95
        return;
100
100
 
101
101
void KScreenDaemon::applyKnownConfig()
102
102
{
103
 
    kDebug() << "Applying known config";
 
103
    qDebug() << "Applying known config";
104
104
    setMonitorForChanges(false);
105
105
    KScreen::Config* config = Serializer::config(Serializer::currentId());
106
106
    if (!KScreen::Config::canBeApplied(config)) {
113
113
 
114
114
void KScreenDaemon::applyIdealConfig()
115
115
{
116
 
    kDebug() << "Applying ideal config";
 
116
    qDebug() << "Applying ideal config";
117
117
    setMonitorForChanges(true);
118
118
    KScreen::Config::setConfig(Generator::self()->idealConfig());
119
119
}
120
120
 
121
121
void KScreenDaemon::configChanged()
122
122
{
123
 
    kDebug() << "Change detected";
 
123
    qDebug() << "Change detected";
124
124
    // Reset timer, delay the writeback
125
125
    m_saveTimer->start();
126
126
}
127
127
 
128
128
void KScreenDaemon::saveCurrentConfig()
129
129
{
130
 
    kDebug() << "Saving current config";
 
130
    qDebug() << "Saving current config";
131
131
    Serializer::saveConfig(KScreen::Config::current());
132
132
}
133
133
 
134
134
void KScreenDaemon::displayButton()
135
135
{
136
 
    kDebug() << "displayBtn triggered";
 
136
    qDebug() << "displayBtn triggered";
137
137
    if (m_timer->isActive()) {
138
 
        kDebug() << "Too fast cowboy";
 
138
        qDebug() << "Too fast cowboy";
139
139
        return;
140
140
    }
141
141
 
144
144
 
145
145
void KScreenDaemon::resetDisplaySwitch()
146
146
{
147
 
    kDebug();
 
147
    qDebug();
148
148
    m_iteration = 0;
149
149
}
150
150
 
156
156
 
157
157
    setMonitorForChanges(true);
158
158
    m_iteration++;
159
 
    kDebug() << "displayButton: " << m_iteration;
160
 
    KDebug::Block genericConfig("Applying display switch");
 
159
    qDebug() << "displayButton: " << m_iteration;
 
160
//     KDebug::Block genericConfig("Applying display switch");
161
161
    KScreen::Config::setConfig(Generator::self()->displaySwitch(m_iteration));
162
162
}
163
163
 
165
165
{
166
166
    Q_UNUSED(lidIsClosed);
167
167
//     KDebug::Block genericConfig(" Lid closed");
168
 
//     kDebug() << "Lid is closed:" << lidIsClosed;
 
168
//     qDebug() << "Lid is closed:" << lidIsClosed;
169
169
//     //If the laptop is closed, use ideal config WITHOUT saving it
170
170
//     if (lidIsClosed) {
171
171
//         setMonitorForChanges(false);
214
214
    if (m_monitoring == enabled) {
215
215
        return;
216
216
    }
217
 
    kDebug() << "Monitor for changes: " << enabled;
 
217
    qDebug() << "Monitor for changes: " << enabled;
218
218
    if (!m_monitoredConfig) {
219
219
        m_monitoredConfig = KScreen::Config::current();
220
220
        if (!m_monitoredConfig) {