2 * Copyright 2008 Alex Merry <alex.merry@kdemail.net>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301 USA
24 class AddEditPlaceJob
: public ModelJob
27 AddEditPlaceJob(KFilePlacesModel
* model
,
29 const QVariantMap
& parameters
,
31 : ModelJob(parent
, model
, index
, (index
.isValid() ? "Edit" : "Add"), parameters
)
32 , m_text(parameters
["Name"].toString())
33 , m_url(parameters
["Url"].toUrl())
34 , m_icon(parameters
["Icon"].toString())
39 if (m_index
.isValid()) {
40 m_model
->editPlace(m_index
, m_text
, m_url
, m_icon
);
42 m_model
->addPlace(m_text
, m_url
, m_icon
);
52 class RemovePlaceJob
: public ModelJob
55 RemovePlaceJob(KFilePlacesModel
* model
, const QModelIndex
& index
,
57 : ModelJob(parent
, model
, index
, "Remove")
62 m_model
->removePlace(m_index
);
66 class ShowPlaceJob
: public ModelJob
69 ShowPlaceJob(KFilePlacesModel
* model
, const QModelIndex
& index
,
70 bool show
= true, QObject
* parent
= 0)
71 : ModelJob(parent
, model
, index
, (show
? "Show" : "Hide"))
77 m_model
->setPlaceHidden(m_index
, m_show
);
84 class TeardownDeviceJob
: public ModelJob
87 TeardownDeviceJob(KFilePlacesModel
* model
, const QModelIndex
& index
,
89 : ModelJob(parent
, model
, index
, "Teardown Device")
94 m_model
->requestTeardown(m_index
);
98 #include "setupdevicejob.h"