filemanager/dialogs/filepropertiesdialog.h

110 lines
3.2 KiB
C
Raw Permalink Normal View History

2021-03-29 01:51:34 -07:00
/*
* Copyright (C) 2021 CutefishOS Team.
*
* Author: Reion Wong <reionwong@gmail.com>
2021-03-29 01:51:34 -07:00
*
* 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 3 of the License, or
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef FILEPROPERTIESDIALOG_H
#define FILEPROPERTIESDIALOG_H
2021-03-16 00:02:20 -07:00
#include <QQuickView>
#include <QTimer>
2021-03-16 00:02:20 -07:00
#include <QUrl>
2021-09-03 13:35:54 -07:00
#include <QSharedPointer>
2021-03-16 00:02:20 -07:00
#include <KFileItem>
#include <KIO/DirectorySizeJob>
2021-09-03 13:35:54 -07:00
#include "cio/cfilesizejob.h"
class FilePropertiesDialog : public QQuickView
2021-03-16 00:02:20 -07:00
{
Q_OBJECT
Q_PROPERTY(QString location READ location NOTIFY locationChanged)
2021-03-16 00:02:20 -07:00
Q_PROPERTY(QString fileName READ fileName NOTIFY fileNameChanged)
Q_PROPERTY(QString iconName READ iconName NOTIFY iconNameChanged)
Q_PROPERTY(QString mimeType READ mimeType NOTIFY mimeTypeChanged)
Q_PROPERTY(QString fileSize READ fileSize NOTIFY fileSizeChanged)
Q_PROPERTY(QString creationTime READ creationTime NOTIFY creationTimeChanged)
Q_PROPERTY(QString modifiedTime READ modifiedTime NOTIFY modifiedTimeChanged)
Q_PROPERTY(QString accessedTime READ accessedTime NOTIFY accessedTimeChanged)
2021-03-16 00:02:20 -07:00
Q_PROPERTY(bool multiple READ multiple CONSTANT)
Q_PROPERTY(bool isWritable READ isWritable NOTIFY isWritableChanged)
2021-03-16 00:02:20 -07:00
public:
explicit FilePropertiesDialog(const KFileItem &item, QQuickView *parent = nullptr);
explicit FilePropertiesDialog(const KFileItemList &items, QQuickView *parent = nullptr);
explicit FilePropertiesDialog(const QUrl &url, QQuickView *parent = nullptr);
~FilePropertiesDialog();
2021-03-16 00:02:20 -07:00
2021-09-20 07:13:42 -07:00
Q_INVOKABLE void updateSize(int width, int height);
Q_INVOKABLE void accept(const QString &text);
Q_INVOKABLE void reject();
2021-03-16 00:02:20 -07:00
bool multiple() const;
2021-03-29 01:51:34 -07:00
bool isWritable() const;
2021-03-16 00:02:20 -07:00
QString location() const;
QString fileName() const;
QString iconName() const;
QString mimeType() const;
QString fileSize() const;
2021-03-16 00:02:20 -07:00
QString creationTime() const;
QString modifiedTime() const;
QString accessedTime() const;
signals:
void locationChanged();
2021-03-16 00:02:20 -07:00
void fileNameChanged();
void iconNameChanged();
void mimeTypeChanged();
void fileSizeChanged();
void creationTimeChanged();
void modifiedTimeChanged();
void accessedTimeChanged();
void isWritableChanged();
protected:
bool event(QEvent *e) override;
2021-03-16 00:02:20 -07:00
private:
void init();
private slots:
2021-09-03 13:35:54 -07:00
void updateTotalSize();
2021-03-16 00:02:20 -07:00
private:
KFileItemList m_items;
QString m_location;
QString m_fileName;
QString m_iconName;
QString m_mimeType;
QString m_size;
QString m_creationTime;
QString m_modifiedTime;
QString m_accessedTime;
2021-09-03 13:35:54 -07:00
std::shared_ptr<CFileSizeJob> m_sizeJob;
2021-03-16 00:02:20 -07:00
bool m_multiple;
bool m_isWritable;
2021-03-16 00:02:20 -07:00
};
#endif // FILEPROPERTIESDIALOG_H