Debian Codegraph @

src/gui/operations/RenameOperation.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2020 Damir Porobic <[email protected]>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program 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
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef KSNIP_RENAMEOPERATION_H
21 #define KSNIP_RENAMEOPERATION_H
22
23 #include <QCoreApplication>
24 #include <QFile>
25 #include <QInputDialog>
26
27 #include <utility>
28
29 #include "NotifyOperation.h"
30 #include "src/common/dtos/RenameResultDto.h"
31 #include "src/common/helper/PathHelper.h"
32 #include "src/gui/INotificationService.h"
33
34 class RenameOperation : public QObject
35 {
36 Q_OBJECT
37 public:
38 RenameOperation(
39 const QString &pathToImageSource,
40 const QString &imageFilename,
41 const QSharedPointer<INotificationService> &notificationService,
42 const QSharedPointer<IConfig> &config,
43 QWidget *parent);
44 ~RenameOperation() override = default;
45 RenameResultDto execute();
46
47 private:
48 QWidget* mParent;
49 QString mPathToImageSource;
50 QString mImageFilename;
51 QSharedPointer<INotificationService> mNotificationService;
52 QSharedPointer<IConfig> mConfig;
53
54 QString getNewFilename() const;
55 bool rename(const QString &newFilename);
56 };
57
58 #endif //KSNIP_RENAMEOPERATION_H