Kate
insertfileplugin.h
Go to the documentation of this file.00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2002 Anders Lund <anders@alweb.dk> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 #ifndef _INSERT_FILE_PLUGIN_H_ 00020 #define _INSERT_FILE_PLUGIN_H_ 00021 00022 #include <ktexteditor/plugin.h> 00023 #include <ktexteditor/view.h> 00024 00025 #include <kxmlguiclient.h> 00026 #include <QtCore/QObject> 00027 #include <jobclasses.h> 00028 #include <kurl.h> 00029 00030 class InsertFilePlugin : public KTextEditor::Plugin 00031 { 00032 Q_OBJECT 00033 00034 public: 00035 explicit InsertFilePlugin( QObject *parent = 0, 00036 const QVariantList &args = QVariantList() ); 00037 virtual ~InsertFilePlugin(); 00038 00039 void addView (KTextEditor::View *view); 00040 void removeView (KTextEditor::View *view); 00041 00042 00043 private: 00044 QList<class InsertFilePluginView*> m_views; 00045 }; 00046 00047 class InsertFilePluginView : public QObject, public KXMLGUIClient 00048 { 00049 Q_OBJECT 00050 public: 00051 explicit InsertFilePluginView( KTextEditor::View *view, const char *name=0 ); 00052 ~InsertFilePluginView() {} 00053 public Q_SLOTS: 00054 /* display a file dialog, and insert the chosen file */ 00055 void slotInsertFile(); 00056 private Q_SLOTS: 00057 void slotFinished( KJob *job ); 00058 //slotAborted( KIO::Job *job ); 00059 private: 00060 void insertFile(); 00061 KUrl _file; 00062 QString _tmpfile; 00063 KIO::FileCopyJob *_job; 00064 }; 00065 00066 #endif // _INSERT_FILE_PLUGIN_H_