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 <kjob.h> 00028 #include <kurl.h> 00029 #include <kio/job.h> 00030 00031 class InsertFilePlugin : public KTextEditor::Plugin 00032 { 00033 Q_OBJECT 00034 00035 public: 00036 explicit InsertFilePlugin( QObject *parent = 0, 00037 const QVariantList &args = QVariantList() ); 00038 virtual ~InsertFilePlugin(); 00039 00040 void addView (KTextEditor::View *view); 00041 void removeView (KTextEditor::View *view); 00042 00043 00044 private: 00045 QList<class InsertFilePluginView*> m_views; 00046 }; 00047 00048 class InsertFilePluginView : public QObject, public KXMLGUIClient 00049 { 00050 Q_OBJECT 00051 public: 00052 explicit InsertFilePluginView( KTextEditor::View *view, const char *name=0 ); 00053 ~InsertFilePluginView() {} 00054 public Q_SLOTS: 00055 /* display a file dialog, and insert the chosen file */ 00056 void slotInsertFile(); 00057 private Q_SLOTS: 00058 void slotFinished( KJob *job ); 00059 //slotAborted( KIO::Job *job ); 00060 private: 00061 void insertFile(); 00062 KUrl _file; 00063 QString _tmpfile; 00064 KIO::FileCopyJob *_job; 00065 }; 00066 00067 #endif // _INSERT_FILE_PLUGIN_H_