~ubuntu-branches/ubuntu/gutsy/kde4libs/gutsy

« back to all changes in this revision

Viewing changes to kate/plugins/insertfile/insertfileplugin.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-02-21 11:00:12 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070221110012-6kw8khr9knv6lmg1
Tags: 3.80.3-0ubuntu1
New upstream unstable release

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <assert.h>
25
25
#include <kio/job.h>
26
26
#include <kaction.h>
 
27
#include <kactioncollection.h>
27
28
#include <kfiledialog.h>
28
29
#include <kgenericfactory.h>
29
30
#include <klocale.h>
30
31
#include <kmessagebox.h>
31
32
#include <kpushbutton.h>
32
 
#include <ktempfile.h>
 
33
#include <ktemporaryfile.h>
33
34
#include <kurl.h>
34
35
 
35
36
#include <qfile.h>
80
81
  setObjectName( name );
81
82
 
82
83
  view->insertChildClient( this );
83
 
  setInstance( KGenericFactory<InsertFilePlugin>::instance() );
 
84
  setComponentData( KGenericFactory<InsertFilePlugin>::componentData() );
84
85
  _job = 0;
85
86
 
86
 
  KAction *action = new KAction( i18n("Insert File..."), actionCollection(), "tools_insert_file" );
 
87
  KAction *action = new KAction( i18n("Insert File..."), this );
 
88
  actionCollection()->addAction( "tools_insert_file", action );
87
89
  connect( action, SIGNAL( triggered( bool ) ), this, SLOT(slotInsertFile()) );
88
90
 
89
91
  setXMLFile( "ktexteditor_insertfileui.rc" );
107
109
    insertFile();
108
110
  }
109
111
  else {
110
 
    KTempFile tempFile( QString::null );
111
 
    _tmpfile = tempFile.name();
 
112
    KTemporaryFile tempFile;
 
113
    tempFile.setAutoRemove(false);
 
114
    tempFile.open();
 
115
    _tmpfile = tempFile.fileName();
112
116
 
113
117
    KUrl destURL;
114
118
    destURL.setPath( _tmpfile );
154
158
  uint len = 0;
155
159
  while (!stream.atEnd()) {
156
160
    if ( numlines )
157
 
      str += "\n";
 
161
      str += '\n';
158
162
    tmp = stream.readLine();
159
163
    str += tmp;
160
164
    len = tmp.length();