mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 10:22:52 +00:00

required the following commit from kdelibs to actually save: 319ebf4d2089a167b2a9e1f746eb52cd54dec150 Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
132 lines
3.7 KiB
C++
132 lines
3.7 KiB
C++
/*
|
|
* ark -- archiver for the KDE project
|
|
*
|
|
* Copyright (C) 2007 Henrique Pinto <henrique.pinto@kdemail.net>
|
|
* Copyright (C) 2008-2009 Harald Hvaal <haraldhv@stud.ntnu.no>
|
|
* Copyright (C) 2009 Raphael Kubo da Costa <rakuco@FreeBSD.org>
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version 2
|
|
* of the License, or (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*
|
|
*/
|
|
#ifndef PART_H
|
|
#define PART_H
|
|
|
|
#include "interface.h"
|
|
|
|
#include <QModelIndex>
|
|
#include <QAction>
|
|
#include <QSplitter>
|
|
#include <QTreeView>
|
|
|
|
#include <KParts/Part>
|
|
#include <KTempDir>
|
|
|
|
class ArchiveModel;
|
|
class InfoPanel;
|
|
class KAbstractWidgetJobTracker;
|
|
class KAboutData;
|
|
class KAction;
|
|
class KJob;
|
|
|
|
namespace Ark
|
|
{
|
|
|
|
class Part: public KParts::ReadWritePart, public Interface
|
|
{
|
|
Q_OBJECT
|
|
Q_INTERFACES(Interface)
|
|
public:
|
|
enum PreviewMode {
|
|
InternalViewer,
|
|
ExternalProgram
|
|
};
|
|
|
|
Part(QWidget *parentWidget, QObject *parent, const QVariantList &);
|
|
~Part();
|
|
|
|
static KAboutData* createAboutData();
|
|
|
|
bool openFile() final;
|
|
bool saveFile() final;
|
|
|
|
bool isBusy() const;
|
|
|
|
public slots:
|
|
void extractSelectedFilesTo(const QString& localPath);
|
|
|
|
private slots:
|
|
void slotLoadingStarted();
|
|
void slotLoadingFinished(KJob *job);
|
|
void slotPreviewWithInternalViewer();
|
|
void slotPreviewWithExternalProgram();
|
|
void slotPreviewExtracted(KJob*);
|
|
void slotError(const QString& errorMessage, const QString& details);
|
|
void slotExtractFiles();
|
|
void slotExtractionDone(KJob*);
|
|
void slotQuickExtractFiles(QAction*);
|
|
void slotAddFiles();
|
|
void slotAddFiles(const QStringList& files, const QString& path = QString());
|
|
void slotAddDir();
|
|
void slotAddFilesDone(KJob*);
|
|
void slotDeleteFiles();
|
|
void slotDeleteFilesDone(KJob*);
|
|
void slotShowContextMenu();
|
|
void saveSplitterSizes();
|
|
void slotToggleInfoPanel(bool);
|
|
void slotSaveAs();
|
|
void updateActions();
|
|
void selectionChanged();
|
|
void adjustColumns();
|
|
void setBusyGui();
|
|
void setReadyGui();
|
|
void setFileNameFromArchive();
|
|
|
|
signals:
|
|
void busy();
|
|
void ready();
|
|
void quit();
|
|
|
|
private:
|
|
void setupView();
|
|
void setupActions();
|
|
bool isSingleFolderArchive() const;
|
|
QString detectSubfolder() const;
|
|
bool isPreviewable(const QModelIndex& index) const;
|
|
QList<QVariant> selectedFiles();
|
|
QList<QVariant> selectedFilesWithChildren();
|
|
void registerJob(KJob *job);
|
|
void preview(const QModelIndex &index, PreviewMode mode);
|
|
|
|
ArchiveModel *m_model;
|
|
QTreeView *m_view;
|
|
KAction *m_previewChooseAppAction;
|
|
KAction *m_previewAction;
|
|
KAction *m_extractFilesAction;
|
|
KAction *m_addFilesAction;
|
|
KAction *m_addDirAction;
|
|
KAction *m_deleteFilesAction;
|
|
KAction *m_saveAsAction;
|
|
InfoPanel *m_infoPanel;
|
|
QSplitter *m_splitter;
|
|
QList<KTempDir*> m_previewDirList;
|
|
bool m_busy;
|
|
PreviewMode m_previewMode;
|
|
|
|
KAbstractWidgetJobTracker *m_jobTracker;
|
|
};
|
|
|
|
} // namespace Ark
|
|
|
|
#endif // PART_H
|