• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeparts
 

tdeparts

  • tdeparts
browserrun.h
1 /* This file is part of the KDE project
2  *
3  * Copyright (C) 2002 David Faure <faure@kde.org>
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License version 2, as published by the Free Software Foundation.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Library General Public License for more details.
12  *
13  * You should have received a copy of the GNU Library General Public License
14  * along with this library; see the file COPYING.LIB. If not, write to
15  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  * Boston, MA 02110-1301, USA.
17  */
18 
19 #ifndef tdeparts_browserrun_h
20 #define tdeparts_browserrun_h
21 
22 #include <krun.h>
23 #include <kservice.h>
24 #include <tdeparts/browserextension.h>
25 
26 namespace KParts {
27 
42  class TDEPARTS_EXPORT BrowserRun : public KRun
43  {
44  TQ_OBJECT
45  public:
55  BrowserRun( const KURL& url, const KParts::URLArgs& args,
56  KParts::ReadOnlyPart *part, TQWidget *window,
57  bool removeReferrer, bool trustedSource );
58 
59  // BIC: merge with above constructor
71  BrowserRun( const KURL& url, const KParts::URLArgs& args,
72  KParts::ReadOnlyPart *part, TQWidget *window,
73  bool removeReferrer, bool trustedSource, bool hideErrorDialog );
74 
75  virtual ~BrowserRun();
76 
77  //KParts::URLArgs urlArgs() const { return m_args; }
78  //KParts::ReadOnlyPart* part() const { return m_part; }
79 
83  KURL url() const { return m_strURL; }
84 
88  bool hideErrorDialog() const;
89 
93  TQString suggestedFilename() const { return m_suggestedFilename; }
94 
99  TQString contentDisposition() const;
100 
101  bool serverSuggestsSave() const { return contentDisposition() == TQString::fromLatin1("attachment"); }
102 
103  enum AskSaveResult { Save, Open, Cancel };
112  static AskSaveResult askSave( const KURL & url, KService::Ptr offer, const TQString& mimeType, const TQString & suggestedFilename = TQString::null );
113 
114  enum AskEmbedOrSaveFlags { InlineDisposition = 0, AttachmentDisposition = 1 };
124  static AskSaveResult askEmbedOrSave( const KURL & url, const TQString& mimeType, const TQString & suggestedFilename = TQString::null, int flags = 0 );
125 
126  // virtual so that TDEHTML can implement differently (HTML cache)
127  virtual void save( const KURL & url, const TQString & suggestedFilename );
128 
129  // static so that it can be called from other classes
130  static void simpleSave( const KURL & url, const TQString & suggestedFilename,
131  TQWidget* window );
132 
134  static void simpleSave( const KURL & url, const TQString & suggestedFilename );
135 
136  static bool allowExecution( const TQString &serviceType, const KURL &url );
137 
139  static bool isExecutable( const TQString &serviceType );
140  static bool isTextExecutable( const TQString &serviceType );
141 
142  protected:
146  virtual void scanFile();
150  virtual void init();
158  virtual void handleError( TDEIO::Job * job );
159 
164  enum NonEmbeddableResult { Handled, NotHandled, Delayed };
165 
169  NonEmbeddableResult handleNonEmbeddable( const TQString& mimeType );
170 
171  protected slots:
172  void slotBrowserScanFinished(TDEIO::Job *job);
173  void slotBrowserMimetype(TDEIO::Job *job, const TQString &type);
174  void slotCopyToTempFileResult(TDEIO::Job *job);
175  virtual void slotStatResult( TDEIO::Job *job );
176 
177  protected:
178  KParts::URLArgs m_args;
179  KParts::ReadOnlyPart *m_part; // QGuardedPtr?
180  TQGuardedPtr<TQWidget> m_window;
181  // Suggested filename given by the server (e.g. HTTP content-disposition)
182  // When set, we should really be saving instead of embedding
183  TQString m_suggestedFilename;
184  TQString m_sMimeType;
185  bool m_bRemoveReferrer;
186  bool m_bTrustedSource;
187  private:
188  void redirectToError( int error, const TQString& errorText );
189  class BrowserRunPrivate;
190  BrowserRunPrivate* d;
191 
192  };
193 }
194 #endif
KParts::BrowserRun
This class extends KRun to provide additional functionality for browsers:
Definition: browserrun.h:43
KParts::BrowserRun::url
KURL url() const
Definition: browserrun.h:83
KParts::BrowserRun::suggestedFilename
TQString suggestedFilename() const
Definition: browserrun.h:93
KParts::BrowserRun::NonEmbeddableResult
NonEmbeddableResult
NotHandled means that foundMimeType should call KRun::foundMimeType, i.e.
Definition: browserrun.h:164
KParts::ReadOnlyPart
Base class for any "viewer" part.
Definition: part.h:339
KURL
TDEStdAccel::save
const TDEShortcut & save()
KParts::URLArgs
URLArgs is a set of arguments bundled into a structure, to allow specifying how a URL should be opene...
Definition: browserextension.h:58

tdeparts

Skip menu "tdeparts"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeparts

Skip menu "tdeparts"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeparts by doxygen 1.9.1
This website is maintained by Timothy Pearson.