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 $Id: insertfileplugin.h 465272 2005-09-29 09:47:40Z mueller $ 00019 */ 00020 00021 00022 #ifndef _INSERT_FILE_PLUGIN_H_ 00023 #define _INSERT_FILE_PLUGIN_H_ 00024 00025 #include <ktexteditor/plugin.h> 00026 #include <ktexteditor/view.h> 00027 00028 #include <kxmlguiclient.h> 00029 #include <qobject.h> 00030 #include <jobclasses.h> 00031 #include <kurl.h> 00032 00033 class InsertFilePlugin : public KTextEditor::Plugin, public KTextEditor::PluginViewInterface 00034 { 00035 Q_OBJECT 00036 00037 public: 00038 InsertFilePlugin( QObject *parent = 0, 00039 const char* name = 0, 00040 const QStringList &args = QStringList() ); 00041 virtual ~InsertFilePlugin(); 00042 00043 void addView (KTextEditor::View *view); 00044 void removeView (KTextEditor::View *view); 00045 00046 00047 private: 00048 QPtrList<class InsertFilePluginView> m_views; 00049 }; 00050 00051 class InsertFilePluginView : public QObject, public KXMLGUIClient 00052 { 00053 Q_OBJECT 00054 public: 00055 InsertFilePluginView( KTextEditor::View *view, const char *name=0 ); 00056 ~InsertFilePluginView() {}; 00057 public slots: 00058 /* display a file dialog, and insert the chosen file */ 00059 void slotInsertFile(); 00060 private slots: 00061 void slotFinished( KIO::Job *job ); 00062 //slotAborted( KIO::Job *job ); 00063 private: 00064 void insertFile(); 00065 KURL _file; 00066 QString _tmpfile; 00067 KIO::FileCopyJob *_job; 00068 }; 00069 00070 #endif // _INSERT_FILE_PLUGIN_H_