Test if file exists before to execute sed
[kdepim.git] / ktnef / ktnefmain.h
blob7e0f3b9393b885091f3fba870621104d1b0df193
1 /*
2 This file is part of KTnef.
4 Copyright (C) 2002 Michael Goffioul <kdeprint@swing.be>
5 Copyright (c) 2012 Allen Winter <winter@kde.org>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software Foundation,
14 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
17 #ifndef KTNEFMAIN_H
18 #define KTNEFMAIN_H
20 #include <KXmlGuiWindow>
21 #include <KService>
22 class QActionGroup;
23 class QAction;
24 class QContextMenuEvent;
25 class QTreeWidgetItem;
26 class KRecentFilesAction;
27 class QUrl;
29 namespace KTnef
31 class KTNEFParser;
32 class KTNEFAttach;
34 using namespace KTnef;
36 class KTNEFView;
38 class KTNEFMain : public KXmlGuiWindow
40 Q_OBJECT
42 public:
43 explicit KTNEFMain(QWidget *parent = Q_NULLPTR);
44 ~KTNEFMain();
46 void loadFile(const QString &filename);
48 protected:
49 /** @reimp */
50 void contextMenuEvent(QContextMenuEvent *event) Q_DECL_OVERRIDE;
52 protected Q_SLOTS:
53 void openFile();
54 void viewFile();
55 void viewFileAs();
56 void extractFile();
57 void extractFileTo();
58 void propertiesFile();
59 void optionDefaultDir();
60 void extractAllFiles();
61 void slotEditToolbars();
62 void slotNewToolbarConfig();
63 void slotShowMessageProperties();
64 void slotShowMessageText();
65 void slotSaveMessageText();
67 void viewSelectionChanged();
68 void viewDoubleClicked(QTreeWidgetItem *);
69 void viewDragRequested(const QList<KTNEFAttach *> &list);
70 void slotConfigureKeys();
71 void openRecentFile(const QUrl &);
73 // protected:
74 // void closeEvent( QCloseEvent *e );
76 private Q_SLOTS:
77 void slotOpenWithAction(QAction *act);
79 private:
80 void addRecentFile(const QUrl &url);
81 void setupStatusbar();
82 void setupActions();
83 void setupTNEF();
84 void enableExtractAll(bool on = true);
85 void enableSingleAction(bool on = true);
86 void cleanup();
88 void extractTo(const QString &dirname);
89 QString extractTemp(KTNEFAttach *att);
91 void openWith(const KService::Ptr &offer);
92 void createOpenWithMenu(QMenu *topMenu);
93 QAction *createAppAction(const KService::Ptr &service, bool singleOffer, QActionGroup *actionGroup, QObject *parent);
95 private:
96 KTNEFView *mView;
97 KTNEFParser *mParser;
98 QString mFilename;
99 QString mDefaultDir;
100 QString mLastDir;
101 KRecentFilesAction *mOpenRecentFileAction;
103 Q_DECLARE_METATYPE(KService::Ptr)
104 #endif