Changeset View
Changeset View
Standalone View
Standalone View
startkde/kcminit/main.cpp
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Line(s) | 69 | { | |||
---|---|---|---|---|---|
100 | qDebug() << "Initializing " << libName << ": " << kcminit; | 100 | qDebug() << "Initializing " << libName << ": " << kcminit; | ||
101 | init(); | 101 | init(); | ||
102 | return true; | 102 | return true; | ||
103 | } | 103 | } | ||
104 | 104 | | |||
105 | void KCMInit::runModules( int phase ) | 105 | void KCMInit::runModules( int phase ) | ||
106 | { | 106 | { | ||
107 | QString KCMINIT_PREFIX=QStringLiteral("kcminit_"); | 107 | QString KCMINIT_PREFIX=QStringLiteral("kcminit_"); | ||
108 | foreach (const KService::Ptr & service, list) { | 108 | for (const KService::Ptr & service : qAsConst(m_list)) { | ||
109 | const QVariant tmp = service->property(QStringLiteral("X-KDE-Init-Library"), QVariant::String); | 109 | const QVariant tmp = service->property(QStringLiteral("X-KDE-Init-Library"), QVariant::String); | ||
110 | QString library; | 110 | QString library; | ||
111 | if( tmp.isValid() ) | 111 | if( tmp.isValid() ) | ||
112 | { | 112 | { | ||
113 | library = tmp.toString(); | 113 | library = tmp.toString(); | ||
114 | if( !library.startsWith( KCMINIT_PREFIX ) ) | 114 | if( !library.startsWith( KCMINIT_PREFIX ) ) | ||
115 | library = KCMINIT_PREFIX + library; | 115 | library = KCMINIT_PREFIX + library; | ||
116 | } | 116 | } | ||
Show All 13 Lines | |||||
130 | int libphase = 1; | 130 | int libphase = 1; | ||
131 | if( vphase.isValid() ) | 131 | if( vphase.isValid() ) | ||
132 | libphase = vphase.toInt(); | 132 | libphase = vphase.toInt(); | ||
133 | 133 | | |||
134 | if( phase != -1 && libphase != phase ) | 134 | if( phase != -1 && libphase != phase ) | ||
135 | continue; | 135 | continue; | ||
136 | 136 | | |||
137 | // try to load the library | 137 | // try to load the library | ||
138 | if (!alreadyInitialized.contains(library)) { | 138 | if (!m_alreadyInitialized.contains(library)) { | ||
139 | runModule(library, service); | 139 | runModule(library, service); | ||
140 | alreadyInitialized.insert(library); | 140 | m_alreadyInitialized.insert(library); | ||
141 | } | 141 | } | ||
142 | } | 142 | } | ||
143 | } | 143 | } | ||
144 | 144 | | |||
145 | KCMInit::KCMInit( const QCommandLineParser& args ) | 145 | KCMInit::KCMInit( const QCommandLineParser& args ) | ||
146 | { | 146 | { | ||
147 | QString arg; | 147 | QString arg; | ||
148 | if (args.positionalArguments().size() == 1) { | 148 | if (args.positionalArguments().size() == 1) { | ||
149 | arg = args.positionalArguments().first(); | 149 | arg = args.positionalArguments().first(); | ||
150 | } | 150 | } | ||
151 | 151 | | |||
152 | if (args.isSet(QStringLiteral("list"))) { | 152 | if (args.isSet(QStringLiteral("list"))) { | ||
153 | list = KServiceTypeTrader::self()->query( QStringLiteral("KCModuleInit") ); | 153 | m_list = KServiceTypeTrader::self()->query( QStringLiteral("KCModuleInit") ); | ||
154 | 154 | | |||
155 | foreach (const KService::Ptr & service, list) { | 155 | for (const KService::Ptr &service : qAsConst(m_list)) { | ||
156 | if (service->library().isEmpty()) | 156 | if (service->library().isEmpty()) | ||
157 | continue; // Skip | 157 | continue; // Skip | ||
158 | printf("%s\n", QFile::encodeName(service->desktopEntryName()).data()); | 158 | printf("%s\n", QFile::encodeName(service->desktopEntryName()).data()); | ||
159 | } | 159 | } | ||
160 | return; | 160 | return; | ||
161 | } | 161 | } | ||
162 | 162 | | |||
163 | if (!arg.isEmpty()) { | 163 | if (!arg.isEmpty()) { | ||
164 | QString module = arg; | 164 | QString module = arg; | ||
165 | if (!module.endsWith(QLatin1String(".desktop"))) | 165 | if (!module.endsWith(QLatin1String(".desktop"))) | ||
166 | module += QLatin1String(".desktop"); | 166 | module += QLatin1String(".desktop"); | ||
167 | 167 | | |||
168 | KService::Ptr serv = KService::serviceByStorageId( module ); | 168 | KService::Ptr serv = KService::serviceByStorageId( module ); | ||
169 | if ( !serv || serv->library().isEmpty() ) { | 169 | if ( !serv || serv->library().isEmpty() ) { | ||
170 | qCritical() << i18n("Module %1 not found", module); | 170 | qCritical() << i18n("Module %1 not found", module); | ||
171 | return; | 171 | return; | ||
172 | } else { | 172 | } else { | ||
173 | list.append(serv); | 173 | m_list.append(serv); | ||
174 | } | 174 | } | ||
175 | } else { | 175 | } else { | ||
176 | // locate the desktop files | 176 | // locate the desktop files | ||
177 | list = KServiceTypeTrader::self()->query( QStringLiteral("KCModuleInit") ); | 177 | m_list = KServiceTypeTrader::self()->query( QStringLiteral("KCModuleInit") ); | ||
178 | } | 178 | } | ||
179 | 179 | | |||
180 | if( startup ) { | 180 | if( startup ) { | ||
181 | runModules( 0 ); | 181 | runModules( 0 ); | ||
182 | // Tell KSplash that KCMInit has started | 182 | // Tell KSplash that KCMInit has started | ||
183 | QDBusMessage ksplashProgressMessage = QDBusMessage::createMethodCall(QStringLiteral("org.kde.KSplash"), | 183 | QDBusMessage ksplashProgressMessage = QDBusMessage::createMethodCall(QStringLiteral("org.kde.KSplash"), | ||
184 | QStringLiteral("/KSplash"), | 184 | QStringLiteral("/KSplash"), | ||
185 | QStringLiteral("org.kde.KSplash"), | 185 | QStringLiteral("org.kde.KSplash"), | ||
▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines |