Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/shell/sessioncontroller.cpp
Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Line(s) | |||||
72 | static QStringList standardArguments() | 72 | static QStringList standardArguments() | ||
73 | { | 73 | { | ||
74 | QStringList ret; | 74 | QStringList ret; | ||
75 | for(int a = 0; a < argc; ++a) | 75 | for(int a = 0; a < argc; ++a) | ||
76 | { | 76 | { | ||
77 | QString arg = QString::fromLocal8Bit(argv[a]); | 77 | QString arg = QString::fromLocal8Bit(argv[a]); | ||
78 | if(arg.startsWith(QLatin1String("-graphicssystem")) || arg.startsWith(QLatin1String("-style"))) | 78 | if(arg.startsWith(QLatin1String("-graphicssystem")) || arg.startsWith(QLatin1String("-style"))) | ||
79 | { | 79 | { | ||
80 | ret << '-' + arg; | 80 | ret << QLatin1Char('-') + arg; | ||
81 | if(a+1 < argc) | 81 | if(a+1 < argc) | ||
82 | ret << QString::fromLocal8Bit(argv[a+1]); | 82 | ret << QString::fromLocal8Bit(argv[a+1]); | ||
83 | } | 83 | } | ||
84 | } | 84 | } | ||
85 | return ret; | 85 | return ret; | ||
86 | } | 86 | } | ||
87 | 87 | | |||
88 | class SessionControllerPrivate : public QObject | 88 | class SessionControllerPrivate : public QObject | ||
▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Line(s) | 208 | { | |||
212 | } | 212 | } | ||
213 | 213 | | |||
214 | QAction* a = new QAction( grp ); | 214 | QAction* a = new QAction( grp ); | ||
215 | a->setText( s->description() ); | 215 | a->setText( s->description() ); | ||
216 | a->setCheckable( false ); | 216 | a->setCheckable( false ); | ||
217 | a->setData(QVariant::fromValue<Session*>(s)); | 217 | a->setData(QVariant::fromValue<Session*>(s)); | ||
218 | 218 | | |||
219 | sessionActions[s] = a; | 219 | sessionActions[s] = a; | ||
220 | q->actionCollection()->addAction( "session_"+s->id().toString(), a ); | 220 | q->actionCollection()->addAction(QLatin1String("session_") + s->id().toString(), a); | ||
221 | connect( s, &Session::sessionUpdated, this, &SessionControllerPrivate::sessionUpdated ); | 221 | connect( s, &Session::sessionUpdated, this, &SessionControllerPrivate::sessionUpdated ); | ||
222 | sessionUpdated( s ); | 222 | sessionUpdated( s ); | ||
223 | } | 223 | } | ||
224 | 224 | | |||
225 | SessionController* q; | 225 | SessionController* q; | ||
226 | 226 | | |||
227 | QHash<Session*, QAction*> sessionActions; | 227 | QHash<Session*, QAction*> sessionActions; | ||
228 | ISession* activeSession; | 228 | ISession* activeSession; | ||
229 | QActionGroup* grp; | 229 | QActionGroup* grp; | ||
230 | 230 | | |||
231 | ISessionLock::Ptr sessionLock; | 231 | ISessionLock::Ptr sessionLock; | ||
232 | 232 | | |||
233 | static QString sessionBaseDirectory() | 233 | static QString sessionBaseDirectory() | ||
234 | { | 234 | { | ||
235 | return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) | 235 | return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) | ||
236 | +'/'+ qApp->applicationName() + "/sessions/"; | 236 | + QLatin1Char('/') + qApp->applicationName() + QLatin1String("/sessions/"); | ||
237 | } | 237 | } | ||
238 | 238 | | |||
239 | QString ownSessionDirectory() const | 239 | QString ownSessionDirectory() const | ||
240 | { | 240 | { | ||
241 | Q_ASSERT(activeSession); | 241 | Q_ASSERT(activeSession); | ||
242 | return q->sessionDirectory( activeSession->id().toString() ); | 242 | return q->sessionDirectory( activeSession->id().toString() ); | ||
243 | } | 243 | } | ||
244 | 244 | | |||
▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Line(s) | 376 | { | |||
377 | ret << s; | 377 | ret << s; | ||
378 | } | 378 | } | ||
379 | return ret; | 379 | return ret; | ||
380 | } | 380 | } | ||
381 | 381 | | |||
382 | Session* SessionController::createSession( const QString& name ) | 382 | Session* SessionController::createSession( const QString& name ) | ||
383 | { | 383 | { | ||
384 | Session* s; | 384 | Session* s; | ||
385 | if(name.startsWith('{')) | 385 | if(name.startsWith(QLatin1Char('{'))) { | ||
386 | { | | |||
387 | s = new Session( QUuid(name).toString(), this ); | 386 | s = new Session( QUuid(name).toString(), this ); | ||
388 | }else{ | 387 | }else{ | ||
389 | qsrand(QDateTime::currentDateTimeUtc().toTime_t()); | 388 | qsrand(QDateTime::currentDateTimeUtc().toTime_t()); | ||
390 | s = new Session( QUuid::createUuid().toString(), this ); | 389 | s = new Session( QUuid::createUuid().toString(), this ); | ||
391 | s->setName( name ); | 390 | s->setName( name ); | ||
392 | } | 391 | } | ||
393 | d->addSession( s ); | 392 | d->addSession( s ); | ||
394 | updateXmlGuiActionList(); | 393 | updateXmlGuiActionList(); | ||
▲ Show 20 Lines • Show All 264 Lines • Show Last 20 Lines |