libyui-qt-pkg
2.47.2
YQPkgServiceFilterView.cc
1
/**************************************************************************
2
Copyright (C) 2018 SUSE LLC
3
All Rights Reserved.
4
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License along
16
with this program; if not, write to the Free Software Foundation, Inc.,
17
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18
19
Textdomain "qt-pkg"
20
21
*/
22
23
#define YUILogComponent "qt-pkg"
24
#include <YUILog.h>
25
#include <YUIException.h>
26
27
#include "YQZypp.h"
28
#include "YQPkgServiceFilterView.h"
29
#include "YQPkgServiceList.h"
30
31
YQPkgServiceFilterView::YQPkgServiceFilterView
( QWidget * parent )
32
:
YQPkgSecondaryFilterView
( parent )
33
{
34
_serviceList =
new
YQPkgServiceList
(
this
);
35
YUI_CHECK_NEW( _serviceList );
36
init
(_serviceList);
37
}
38
39
YQPkgServiceFilterView::~YQPkgServiceFilterView
()
40
{
41
// NOP
42
}
43
44
void
YQPkgServiceFilterView::primaryFilter()
45
{
46
_serviceList->
filter
();
47
}
48
49
void
YQPkgServiceFilterView::primaryFilterIfVisible()
50
{
51
_serviceList->
filterIfVisible
();
52
}
53
54
// check if a libzypp service is present
55
bool
YQPkgServiceFilterView::any_service
()
56
{
57
bool
ret = std::any_of(ZyppRepositoriesBegin(), ZyppRepositoriesEnd(), [&](
const
zypp::Repository& repo) {
58
// if the repository does not belong to any service then the service name is empty
59
return
!repo.info().service().empty();
60
});
61
62
yuiMilestone() <<
"Found a libzypp service: "
<< ret << std::endl;
63
return
ret;
64
}
65
YQPkgServiceFilterView::YQPkgServiceFilterView
YQPkgServiceFilterView(QWidget *parent)
Constructor.
Definition:
YQPkgServiceFilterView.cc:31
YQPkgServiceFilterView::~YQPkgServiceFilterView
virtual ~YQPkgServiceFilterView()
Destructor.
Definition:
YQPkgServiceFilterView.cc:39
YQPkgServiceList::filterIfVisible
void filterIfVisible()
Same as filter(), but only if this widget is currently visible.
Definition:
YQPkgServiceList.cc:110
YQPkgServiceList::filter
void filter()
Filter according to the view's rules and current selection.
Definition:
YQPkgServiceList.cc:117
YQPkgSecondaryFilterView
This is a base class for filter views containing a secondary filter.
Definition:
YQPkgSecondaryFilterView.h:35
YQPkgSecondaryFilterView::init
void init(QWidget *primary_widget)
Initialize the primary widget.
Definition:
YQPkgSecondaryFilterView.cc:42
YQPkgServiceList
A widget to display a list of libzypp services.
Definition:
YQPkgServiceList.h:42
YQPkgServiceFilterView::any_service
static bool any_service()
Is any enabled libzypp service present?
Definition:
YQPkgServiceFilterView.cc:55
src
YQPkgServiceFilterView.cc
Generated by
1.8.16