Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/shell/session.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | |||||
45 | public: | 45 | public: | ||
46 | SessionInfo info; | 46 | SessionInfo info; | ||
47 | Session* q; | 47 | Session* q; | ||
48 | bool isTemporary; | 48 | bool isTemporary; | ||
49 | 49 | | |||
50 | QUrl pluginArea( const IPlugin* plugin ) | 50 | QUrl pluginArea( const IPlugin* plugin ) | ||
51 | { | 51 | { | ||
52 | QString name = Core::self()->pluginController()->pluginInfo(plugin).pluginId(); | 52 | QString name = Core::self()->pluginController()->pluginInfo(plugin).pluginId(); | ||
53 | QUrl url = QUrl::fromLocalFile( info.path + '/' + name ); | 53 | QUrl url = QUrl::fromLocalFile(info.path + QLatin1Char('/') + name ); | ||
54 | if( !QFile::exists( url.toLocalFile() ) ) { | 54 | if( !QFile::exists( url.toLocalFile() ) ) { | ||
55 | QDir( info.path ).mkdir( name ); | 55 | QDir( info.path ).mkdir( name ); | ||
56 | } | 56 | } | ||
57 | return url; | 57 | return url; | ||
58 | } | 58 | } | ||
59 | 59 | | |||
60 | SessionPrivate( Session* session, const QString& id ) | 60 | SessionPrivate( Session* session, const QString& id ) | ||
61 | : info( Session::parse( id, true ) ) | 61 | : info( Session::parse( id, true ) ) | ||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 153 | foreach( const QUrl& url, info.projects ) { | |||
155 | if( ICore::self() && ICore::self()->projectController() ) { | 155 | if( ICore::self() && ICore::self()->projectController() ) { | ||
156 | project = ICore::self()->projectController()->findProjectForUrl( url ); | 156 | project = ICore::self()->projectController()->findProjectForUrl( url ); | ||
157 | } | 157 | } | ||
158 | 158 | | |||
159 | if( project ) { | 159 | if( project ) { | ||
160 | projectNames << project->name(); | 160 | projectNames << project->name(); | ||
161 | } else { | 161 | } else { | ||
162 | QString projectName = url.fileName(); | 162 | QString projectName = url.fileName(); | ||
163 | projectName.remove( QRegExp( "\\.kdev4$", Qt::CaseInsensitive ) ); | 163 | projectName.remove(QRegExp(QStringLiteral("\\.kdev4$"), Qt::CaseInsensitive)); | ||
164 | projectNames << projectName; | 164 | projectNames << projectName; | ||
165 | } | 165 | } | ||
166 | } | 166 | } | ||
167 | 167 | | |||
168 | if( projectNames.isEmpty() ) { | 168 | if( projectNames.isEmpty() ) { | ||
169 | return i18n("(no projects)"); | 169 | return i18n("(no projects)"); | ||
170 | } else { | 170 | } else { | ||
171 | return projectNames.join( QStringLiteral(", ") ); | 171 | return projectNames.join( QStringLiteral(", ") ); | ||
172 | } | 172 | } | ||
173 | } | 173 | } | ||
174 | 174 | | |||
175 | QString SessionPrivate::generateDescription( const SessionInfo& info ) | 175 | QString SessionPrivate::generateDescription( const SessionInfo& info ) | ||
176 | { | 176 | { | ||
177 | QString prettyContentsFormatted = generatePrettyContents( info ); | 177 | QString prettyContentsFormatted = generatePrettyContents( info ); | ||
178 | QString description; | 178 | QString description; | ||
179 | 179 | | |||
180 | if( info.name.isEmpty() ) { | 180 | if( info.name.isEmpty() ) { | ||
181 | description = prettyContentsFormatted; | 181 | description = prettyContentsFormatted; | ||
182 | } else { | 182 | } else { | ||
183 | description = info.name + ": " + prettyContentsFormatted; | 183 | description = info.name + QLatin1String(": ") + prettyContentsFormatted; | ||
184 | } | 184 | } | ||
185 | 185 | | |||
186 | return description; | 186 | return description; | ||
187 | } | 187 | } | ||
188 | 188 | | |||
189 | void SessionPrivate::buildDescription( SessionInfo& info ) | 189 | void SessionPrivate::buildDescription( SessionInfo& info ) | ||
190 | { | 190 | { | ||
191 | QString description = generateDescription( info ); | 191 | QString description = generateDescription( info ); | ||
Show All 15 Lines | 205 | if( mkdir ) { | |||
207 | Q_ASSERT( sessionDir.exists() ); | 207 | Q_ASSERT( sessionDir.exists() ); | ||
208 | } else { | 208 | } else { | ||
209 | return ret; | 209 | return ret; | ||
210 | } | 210 | } | ||
211 | } | 211 | } | ||
212 | 212 | | |||
213 | ret.uuid = id; | 213 | ret.uuid = id; | ||
214 | ret.path = sessionPath; | 214 | ret.path = sessionPath; | ||
215 | ret.config = KSharedConfig::openConfig( sessionPath + "/sessionrc" ); | 215 | ret.config = KSharedConfig::openConfig(sessionPath + QLatin1String("/sessionrc")); | ||
216 | 216 | | |||
217 | KConfigGroup cfgRootGroup = ret.config->group( QString() ); | 217 | KConfigGroup cfgRootGroup = ret.config->group( QString() ); | ||
218 | KConfigGroup cfgOptionsGroup = ret.config->group( cfgSessionOptionsGroup ); | 218 | KConfigGroup cfgOptionsGroup = ret.config->group( cfgSessionOptionsGroup ); | ||
219 | 219 | | |||
220 | ret.name = cfgRootGroup.readEntry( cfgSessionNameEntry, QString() ); | 220 | ret.name = cfgRootGroup.readEntry( cfgSessionNameEntry, QString() ); | ||
221 | ret.projects = cfgOptionsGroup.readEntry( cfgSessionProjectsEntry, QList<QUrl>() ); | 221 | ret.projects = cfgOptionsGroup.readEntry( cfgSessionProjectsEntry, QList<QUrl>() ); | ||
222 | SessionPrivate::buildDescription( ret ); | 222 | SessionPrivate::buildDescription( ret ); | ||
223 | 223 | | |||
224 | return ret; | 224 | return ret; | ||
225 | } | 225 | } | ||
226 | 226 | | |||
227 | } | 227 | } | ||
228 | 228 | |