File: filetypedetails.h

package info (click to toggle)
kde-cli-tools 4%3A5.14.5-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,064 kB
  • sloc: cpp: 4,218; sh: 71; makefile: 11
file content (104 lines) | stat: -rw-r--r-- 2,918 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/* This file is part of the KDE project
   Copyright (C) 2000, 2007 David Faure <faure@kde.org>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License version 2 or at your option version 3 as published by
   the Free Software Foundation.

   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; see the file COPYING.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef FILETYPEDETAILS_H
#define FILETYPEDETAILS_H

#include <QTabWidget>

class KIconButton;
class MimeTypeData;
class TypesListItem;
class QLabel;
class QListWidget;
class QGroupBox;
class QButtonGroup;
class QCheckBox;
class QRadioButton;
class KLineEdit;
class QPushButton;
class KServiceListWidget;

/**
 * This widget contains the right part of the file type configuration
 * dialog, that shows the details for a file type.
 * It is implemented as a separate class so that it can be used by
 * the keditfiletype program to show the details of a single mimetype.
 */
class FileTypeDetails : public QWidget
{
  Q_OBJECT
public:
    explicit FileTypeDetails(QWidget *parent = nullptr);

    /**
     * Set a non-gui "mimetype data" to work on,
     * and optionally a gui "treeview item", to update its icon if set.
     */
    void setMimeTypeData( MimeTypeData * mimeTypeData, TypesListItem* item = nullptr );

    /**
     * Called when ksycoca has changed
     */
    void refresh();

protected:
  void updateRemoveButton();
  void updateAskSave();

Q_SIGNALS:
  void embedMajor(const QString &major, bool &embed); // To adjust whether major type is being embedded
  void changed(bool);

protected Q_SLOTS:
  void updateIcon(const QString &icon);
  void updateDescription(const QString &desc);
  void addExtension();
  void removeExtension();
  void enableExtButtons();
  void slotAutoEmbedClicked(int button);
  void slotAskSaveToggled(bool);

private:
    MimeTypeData* m_mimeTypeData;
    TypesListItem* m_item; // can be 0, in keditfiletype!

    QLabel* m_mimeTypeLabel;

    QTabWidget* m_tabWidget;

    // First tab - General
    KIconButton* iconButton;
    QLabel* iconLabel; // if icon cannot be changed

  QListWidget *extensionLB;
  QPushButton *addExtButton, *removeExtButton;
  KLineEdit *description;
  KServiceListWidget *serviceListWidget;

  // Second tab - Embedding
  QGroupBox *m_autoEmbedBox;
  QButtonGroup *m_autoEmbedGroup;
  KServiceListWidget *embedServiceListWidget;
  QRadioButton *m_rbOpenSeparate;
  QCheckBox *m_chkAskSave;
  QRadioButton *m_rbGroupSettings;
};

#endif