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
Discover
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
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
Discover
Commits
67410504
Commit
67410504
authored
May 03, 2018
by
Aleix Pol Gonzalez
🐧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dummy: fix remove sources
parent
656ee2a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
6 deletions
+18
-6
libdiscover/backends/DummyBackend/DummySourcesBackend.cpp
libdiscover/backends/DummyBackend/DummySourcesBackend.cpp
+16
-6
libdiscover/backends/DummyBackend/DummySourcesBackend.h
libdiscover/backends/DummyBackend/DummySourcesBackend.h
+2
-0
No files found.
libdiscover/backends/DummyBackend/DummySourcesBackend.cpp
View file @
67410504
...
...
@@ -45,6 +45,7 @@ bool DummySourcesBackend::addSource(const QString& id)
return
false
;
QStandardItem
*
it
=
new
QStandardItem
(
id
);
it
->
setData
(
id
,
AbstractSourcesBackend
::
IdRole
);
it
->
setData
(
QVariant
(
id
+
QLatin1Char
(
' '
)
+
id
),
Qt
::
ToolTipRole
);
it
->
setCheckable
(
true
);
it
->
setCheckState
(
Qt
::
Checked
);
...
...
@@ -52,15 +53,24 @@ bool DummySourcesBackend::addSource(const QString& id)
return
true
;
}
QStandardItem
*
DummySourcesBackend
::
sourceForId
(
const
QString
&
id
)
const
{
for
(
int
i
=
0
,
c
=
m_sources
->
rowCount
();
i
<
c
;
++
i
)
{
const
auto
it
=
m_sources
->
item
(
i
,
0
);
if
(
it
->
text
()
==
id
)
return
it
;
}
return
nullptr
;
}
bool
DummySourcesBackend
::
removeSource
(
const
QString
&
id
)
{
QList
<
QStandardItem
*>
items
=
m_sources
->
findItems
(
id
);
if
(
items
.
count
()
==
1
)
{
m_sources
->
removeRow
(
items
.
first
()
->
row
());
}
else
{
qWarning
()
<<
"couldn't find "
<<
id
<<
items
;
const
auto
it
=
sourceForId
(
id
);
if
(
!
it
)
{
qWarning
()
<<
"couldn't find "
<<
id
;
return
false
;
}
return
items
.
count
()
==
1
;
return
m_sources
->
removeRow
(
it
->
row
())
;
}
QList
<
QAction
*>
DummySourcesBackend
::
actions
()
const
...
...
libdiscover/backends/DummyBackend/DummySourcesBackend.h
View file @
67410504
...
...
@@ -37,6 +37,8 @@ public:
bool
supportsAdding
()
const
override
{
return
true
;
}
private:
QStandardItem
*
sourceForId
(
const
QString
&
id
)
const
;
QStandardItemModel
*
m_sources
;
QAction
*
m_testAction
;
};
...
...
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