File indexing completed on 2024-05-05 04:19:15

0001 // vim: set tabstop=4 shiftwidth=4 expandtab:
0002 /*
0003 Gwenview: an image viewer
0004 Copyright 2007 Aurélien Gâteau <agateau@kde.org>
0005 
0006 This program is free software; you can redistribute it and/or
0007 modify it under the terms of the GNU General Public License
0008 as published by the Free Software Foundation; either version 2
0009 of the License, or (at your option) any later version.
0010 
0011 This program is distributed in the hope that it will be useful,
0012 but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 GNU General Public License for more details.
0015 
0016 You should have received a copy of the GNU General Public License
0017 along with this program; if not, write to the Free Software
0018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0019 
0020 */
0021 #ifndef FILEOPSCONTEXTMANAGERITEM_H
0022 #define FILEOPSCONTEXTMANAGERITEM_H
0023 
0024 // Qt
0025 
0026 // KF
0027 #include <KNewFileMenu>
0028 #include <KService>
0029 
0030 // Local
0031 #include "abstractcontextmanageritem.h"
0032 
0033 class QAction;
0034 class QMimeData;
0035 class QListView;
0036 class KActionCollection;
0037 class KXMLGUIClient;
0038 
0039 namespace Gwenview
0040 {
0041 class SideBarGroup;
0042 
0043 class FileOpsContextManagerItem : public AbstractContextManagerItem
0044 {
0045     Q_OBJECT
0046 public:
0047     FileOpsContextManagerItem(Gwenview::ContextManager *manager, QListView *thumbnailView, KActionCollection *actionCollection, KXMLGUIClient *client);
0048     ~FileOpsContextManagerItem() override;
0049 
0050 private Q_SLOTS:
0051     void updateActions();
0052     void updatePasteAction();
0053     void updateSideBarContent();
0054 
0055     void cut();
0056     void copy();
0057     void paste();
0058     void rename();
0059     void copyTo();
0060     void moveTo();
0061     void linkTo();
0062     void trash();
0063     void del();
0064     void restore();
0065     void showProperties();
0066     void createFolder();
0067     void populateOpenMenu();
0068     void openInNewWindow();
0069     void openWith(QAction *action);
0070     void openContainingFolder();
0071 
0072 private:
0073     QList<QUrl> urlList() const;
0074     void updateServiceList();
0075     QMimeData *selectionMimeData();
0076     QUrl pasteTargetUrl() const;
0077 
0078     QListView *mThumbnailView;
0079     KXMLGUIClient *mXMLGUIClient;
0080     SideBarGroup *mGroup;
0081     QAction *mCutAction;
0082     QAction *mCopyAction;
0083     QAction *mPasteAction;
0084     QAction *mCopyToAction;
0085     QAction *mMoveToAction;
0086     QAction *mLinkToAction;
0087     QAction *mRenameAction;
0088     QAction *mTrashAction;
0089     QAction *mDelAction;
0090     QAction *mRestoreAction;
0091     QAction *mShowPropertiesAction;
0092     QAction *mCreateFolderAction;
0093     QAction *mOpenInNewWindowAction;
0094     QAction *mOpenWithAction;
0095     QAction *mOpenContainingFolderAction;
0096     QList<QAction *> mRegularFileActionList;
0097     QList<QAction *> mTrashFileActionList;
0098     KService::List mServiceList;
0099     KNewFileMenu *mNewFileMenu;
0100     bool mInTrash;
0101 };
0102 
0103 } // namespace
0104 
0105 #endif /* FILEOPSCONTEXTMANAGERITEM_H */