File indexing completed on 2024-04-21 16:33:18

0001 /*
0002     SPDX-FileCopyrightText: 2001 Shie Erlich <krusader@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2001 Rafi Yanai <krusader@users.sourceforge.net>
0004     SPDX-FileCopyrightText: 2004-2022 Krusader Krew <https://krusader.org>
0005 
0006     SPDX-License-Identifier: GPL-2.0-or-later
0007 */
0008 
0009 #ifndef KRSLOTS_H
0010 #define KRSLOTS_H
0011 
0012 // QtCore
0013 #include <QFile>
0014 #include <QObject>
0015 #include <QUrl>
0016 
0017 #include <KCoreAddons/KProcess>
0018 #include <utility>
0019 
0020 class KrMainWindow;
0021 class QUrl;
0022 
0023 class KrProcess : public KProcess
0024 {
0025     Q_OBJECT
0026 
0027     QString tmp1, tmp2;
0028 
0029 public:
0030     KrProcess(QString in1, QString in2)
0031     {
0032         tmp1 = std::move(in1);
0033         tmp2 = std::move(in2);
0034         connect(this, QOverload<int, QProcess::ExitStatus>::of(&KrProcess::finished), this, &KrProcess::processHasExited);
0035     }
0036 
0037 public slots:
0038     void processHasExited()
0039     {
0040         if (!tmp1.isEmpty())
0041             QFile::remove(tmp1);
0042         if (!tmp2.isEmpty())
0043             QFile::remove(tmp2);
0044         deleteLater();
0045     }
0046 };
0047 
0048 class KrSlots : public QObject
0049 {
0050     Q_OBJECT
0051 
0052 public:
0053     enum compareMode { full };
0054 
0055     explicit KrSlots(QObject *parent);
0056     ~KrSlots() override = default;
0057 
0058 public slots:
0059     void sendFileByEmail(const QList<QUrl> &filename);
0060     void compareContent();
0061     void compareContent(const QUrl &, const QUrl &);
0062     void insertFileName(bool fullPath);
0063     void rootKrusader();
0064     void swapPanels();
0065     void showHiddenFiles(bool show);
0066     void toggleSwapSides();
0067     void updateStatusbarVisibility();
0068     void toggleTerminal();
0069     void compareSetup();
0070     void emptyTrash();
0071     void trashPopupMenu();
0072     /** called by actExec* actions to choose the built-in command line mode */
0073     void execTypeSetup();
0074     void refresh(const QUrl &u);
0075     void runKonfigurator(bool firstTime = false);
0076     void startKonfigurator()
0077     {
0078         runKonfigurator(false);
0079     }
0080     void search(); // call the search module
0081     void locate();
0082     void runTerminal(const QString &dir);
0083     void homeTerminal();
0084     void addBookmark();
0085     void toggleFnkeys();
0086     void toggleCmdline();
0087     void multiRename();
0088     void cmdlinePopup();
0089     void slotSplit();
0090     void slotCombine();
0091     void manageUseractions();
0092 #ifdef SYNCHRONIZER_ENABLED
0093     void slotSynchronizeDirs(QStringList selected = QStringList());
0094 #endif
0095     void slotDiskUsage();
0096     void applicationStateChanged();
0097 
0098 protected slots:
0099     void configChanged(bool isGUIRestartNeeded);
0100 
0101 protected:
0102     KrMainWindow *_mainWindow;
0103 };
0104 
0105 #endif