Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Plasma Workspace
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
64
Merge Requests
64
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Plasma
Plasma Workspace
Commits
e3b3e039
Commit
e3b3e039
authored
Dec 01, 2017
by
Aleix Pol Gonzalez
🐧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prefer a vector without the pointer
parent
73123e29
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
29 deletions
+27
-29
ksmserver/autostart.cpp
ksmserver/autostart.cpp
+24
-27
ksmserver/autostart.h
ksmserver/autostart.h
+3
-2
No files found.
ksmserver/autostart.cpp
View file @
e3b3e039
...
...
@@ -31,6 +31,7 @@ public:
QString
startAfter
;
int
phase
;
};
Q_DECLARE_TYPEINFO
(
AutoStartItem
,
Q_MOVABLE_TYPE
);
AutoStart
::
AutoStart
()
:
m_phase
(
-
1
),
m_phasedone
(
false
)
...
...
@@ -39,7 +40,6 @@ AutoStart::AutoStart()
AutoStart
::~
AutoStart
()
{
qDeleteAll
(
m_startList
);
}
void
...
...
@@ -86,18 +86,18 @@ AutoStart::loadAutoStartList()
}
}
for
(
QStringList
::
ConstIterator
it
=
files
.
constBegin
();
it
!=
files
.
constEnd
();
++
it
)
{
for
(
auto
it
=
files
.
constBegin
();
it
!=
files
.
constEnd
();
++
it
)
{
KAutostart
config
(
*
it
);
if
(
!
config
.
autostarts
(
QStringLiteral
(
"KDE"
),
KAutostart
::
CheckAll
))
{
continue
;
}
const
QString
file
=
QStandardPaths
::
locate
(
QStandardPaths
::
GenericConfigLocation
,
QStringLiteral
(
"autostart/"
)
+
*
it
);
AutoStartItem
*
item
=
new
AutoStartI
tem
;
item
->
name
=
extractName
(
*
it
);
item
->
service
=
file
;
item
->
startAfter
=
config
.
startAfter
();
item
->
phase
=
qMax
(
KAutostart
::
BaseDesktop
,
config
.
startPhase
());
const
auto
file
=
QStandardPaths
::
locate
(
QStandardPaths
::
GenericConfigLocation
,
QStringLiteral
(
"autostart/"
)
+
*
it
);
AutoStartItem
i
tem
;
item
.
name
=
extractName
(
file
);
item
.
service
=
file
;
item
.
startAfter
=
config
.
startAfter
();
item
.
phase
=
qMax
(
KAutostart
::
BaseDesktop
,
config
.
startPhase
());
m_startList
.
append
(
item
);
}
}
...
...
@@ -113,15 +113,14 @@ AutoStart::startService()
// Check for items that depend on previously started items
QString
lastItem
=
m_started
[
0
];
QMutable
ListIterator
<
AutoStartItem
*
>
it
(
m_startList
);
QMutable
VectorIterator
<
AutoStartItem
>
it
(
m_startList
);
while
(
it
.
hasNext
())
{
AutoStartItem
*
item
=
it
.
next
();
if
(
item
->
phase
==
m_phase
&&
item
->
startAfter
==
lastItem
)
{
m_started
.
prepend
(
item
->
name
);
QString
service
=
item
->
service
;
const
auto
&
item
=
it
.
next
();
if
(
item
.
phase
==
m_phase
&&
item
.
startAfter
==
lastItem
)
{
m_started
.
prepend
(
item
.
name
);
QString
service
=
item
.
service
;
it
.
remove
();
delete
item
;
return
service
;
}
}
...
...
@@ -129,15 +128,14 @@ AutoStart::startService()
}
// Check for items that don't depend on anything
QMutable
ListIterator
<
AutoStartItem
*
>
it
(
m_startList
);
QMutable
VectorIterator
<
AutoStartItem
>
it
(
m_startList
);
while
(
it
.
hasNext
())
{
const
auto
item
=
it
.
next
();
if
(
item
->
phase
==
m_phase
&&
item
->
startAfter
.
isEmpty
())
{
m_started
.
prepend
(
item
->
name
);
QString
service
=
item
->
service
;
const
auto
&
item
=
it
.
next
();
if
(
item
.
phase
==
m_phase
&&
item
.
startAfter
.
isEmpty
())
{
m_started
.
prepend
(
item
.
name
);
QString
service
=
item
.
service
;
it
.
remove
();
delete
item
;
return
service
;
}
}
...
...
@@ -145,12 +143,11 @@ AutoStart::startService()
// Just start something in this phase
it
=
m_startList
;
while
(
it
.
hasNext
())
{
const
auto
item
=
it
.
next
();
if
(
item
->
phase
==
m_phase
)
{
m_started
.
prepend
(
item
->
name
);
QString
service
=
item
->
service
;
const
auto
&
item
=
it
.
next
();
if
(
item
.
phase
==
m_phase
)
{
m_started
.
prepend
(
item
.
name
);
QString
service
=
item
.
service
;
it
.
remove
();
delete
item
;
return
service
;
}
}
...
...
ksmserver/autostart.h
View file @
e3b3e039
...
...
@@ -20,7 +20,8 @@
#ifndef _AUTOSTART_H_
#define _AUTOSTART_H_
#include <QtCore/QStringList>
#include <QStringList>
#include <QVector>
class
AutoStartItem
;
...
...
@@ -44,7 +45,7 @@ public:
}
private:
Q
List
<
AutoStartItem
*
>
m_startList
;
Q
Vector
<
AutoStartItem
>
m_startList
;
QStringList
m_started
;
int
m_phase
;
bool
m_phasedone
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment