~mzanetti/unity8/panel-button-fixes

« back to all changes in this revision

Viewing changes to plugins/Wizard/System.cpp

  • Committer: CI Train Bot
  • Author(s): Albert Astals Cid, Michał Sawicz
  • Date: 2015-09-22 12:57:02 UTC
  • mfrom: (1752.8.47 origin/autopkgtests)
  • Revision ID: ci-train-bot@canonical.com-20150922125702-wboqbqanpto9l9s2
Add DEP-8 test for all our UI and unit tests

Some refactoring was needed:
- added a basic Ubuntu.Web mock
- made plugin path an environment, not a compiled-in bit
- moved Unity.Application resources into .qrc

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    // Register the argument needed for UpdateActivationEnvironment below
34
34
    qDBusRegisterMetaType<QMap<QString,QString>>();
35
35
 
36
 
    m_fsWatcher.addPath(wizardEnabledPath());
37
 
    connect(&m_fsWatcher, &QFileSystemWatcher::fileChanged, this, &System::wizardEnabledChanged);
 
36
    if(!wizardEnabled()) {
 
37
        m_fsWatcher.addPath(wizardEnabledPath());
 
38
    }
 
39
    connect(&m_fsWatcher, &QFileSystemWatcher::fileChanged, this, &System::watcherFileChanged);
38
40
}
39
41
 
40
42
QString System::wizardEnabledPath()
59
61
        QDir(wizardEnabledPath()).mkpath("..");
60
62
        QFile(wizardEnabledPath()).open(QIODevice::WriteOnly);
61
63
        m_fsWatcher.addPath(wizardEnabledPath());
62
 
        wizardEnabledChanged();
 
64
        Q_EMIT wizardEnabledChanged();
63
65
    }
64
66
}
65
67
 
 
68
void System::watcherFileChanged()
 
69
{
 
70
    Q_EMIT wizardEnabledChanged();
 
71
    m_fsWatcher.removePath(wizardEnabledPath());
 
72
}
 
73
 
66
74
void System::setSessionVariable(const QString &variable, const QString &value)
67
75
{
68
76
    // We need to update both upstart's and DBus's environment