konqmisc.h 4.56 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/* This file is part of the KDE project
   Copyright (C) 1998, 1999 David Faure <faure@kde.org>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; see the file COPYING.  If not, write to
Dirk Mueller's avatar
Dirk Mueller committed
16
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Dirk Mueller's avatar
Dirk Mueller committed
17
   Boston, MA 02110-1301, USA.
18 19 20 21 22
*/

#ifndef _konq_misc_h
#define _konq_misc_h

23
#include "konqprivate_export.h"
24

25
#include <krun.h>
David Faure's avatar
David Faure committed
26
#include <kparts/browserextension.h>
27
class KonqMainWindow;
28
class KonqView;
29

30
class KONQ_TESTS_EXPORT KonqMisc
31 32
{
public:
David Faure's avatar
David Faure committed
33 34 35 36 37 38 39 40 41 42
    /*
    private:
      static KonqFileManager *s_pSelf;
    public:
    KonqFileManager() {}
    ~KonqFileManager() {}

    static KonqFileManager *self()
    {
      if ( !s_pSelf )
43
      s_pSelf = new KonqFileManager();
David Faure's avatar
David Faure committed
44 45 46 47 48 49 50 51 52 53 54 55
      return s_pSelf;
     }
    */

    /**
     * Stop full-screen mode in all windows.
     */
    static void abortFullScreenMode();

    /**
     * Create a new window with a single view, showing @p url
     */
Laurent Montel's avatar
Laurent Montel committed
56
    static KonqMainWindow * createSimpleWindow( const KUrl &url, const QString &frameName = QString() );
David Faure's avatar
David Faure committed
57

58 59 60
    /**
     * Create a new window with a single view, showing @p url, using @p args
     */
61
    static KonqMainWindow * createSimpleWindow( const KUrl &url, const KParts::URLArgs &args,
62
						bool tempFile = false);
63

David Faure's avatar
David Faure committed
64 65
    /**
     * Create a new window for @p url using @p args and the appropriate profile for this URL.
66
     * @param forbidUseHTML internal. True when called by "Find Files"
67
     * @param openUrl If it is false, no url is openend in the new window. The url is used to guess the profile
David Faure's avatar
David Faure committed
68
     */
Laurent Montel's avatar
Laurent Montel committed
69
    static KonqMainWindow * createNewWindow( const KUrl &url,
70 71
                                             const KParts::URLArgs &args = KParts::URLArgs(),
                                             bool forbidUseHTML = false,
72
                                             const QStringList &filesToSelect = QStringList(),
73
                                             bool tempFile = false,
74
					     bool openUrl = true);
David Faure's avatar
David Faure committed
75 76 77

    /**
     * Create a new window from the profile defined by @p filename and @p path.
Thorsten Roeder's avatar
Thorsten Roeder committed
78
     * @param url an optional URL to open in this profile.
79
     * @param forbidUseHTML internal. True when called by "Find Files"
80
     * @param openUrl If false no url is opened
David Faure's avatar
David Faure committed
81 82 83
     */
    static KonqMainWindow * createBrowserWindowFromProfile( const QString &path,
                                                            const QString &filename,
Laurent Montel's avatar
KURL--  
Laurent Montel committed
84
                                                            const KUrl &url = KUrl(),
85
                                                            const KParts::URLArgs &args = KParts::URLArgs(),
86
                                                            bool forbidUseHTML = false,
87
                                                            const QStringList& filesToSelect = QStringList(),
88
                                                            bool tempFile = false,
89
							    bool openUrl = true);
90 91 92 93 94 95 96 97

    /**
     * Creates a new window from the history of a view, copies the history
     * @param view the History is copied from this view
     * @param steps Restore currentPos() + steps
     */
    static KonqMainWindow * newWindowFromHistory( KonqView* view, int steps );

David Faure's avatar
David Faure committed
98 99
    /**
     * Applies the URI filters to @p url.
100
     *
David Faure's avatar
David Faure committed
101
     * @p parent is used in case of a message box.
102 103
     * @p _url to be filtered.
     * @p _path the absolute path to append to the url before filtering it.
David Faure's avatar
David Faure committed
104
     */
Laurent Montel's avatar
Laurent Montel committed
105
    static QString konqFilteredURL( QWidget* /*parent*/, const QString& /*_url*/, const QString& _path = QString() );
106

107 108
};

Dirk Mueller's avatar
Dirk Mueller committed
109
#include <QtGui/QLabel>
110

111
class KonqDraggableLabel : public QLabel
112
{
George Staikos's avatar
George Staikos committed
113
    Q_OBJECT
114 115 116 117 118 119 120 121 122 123
public:
    KonqDraggableLabel( KonqMainWindow * mw, const QString & text );

protected:
    void mousePressEvent( QMouseEvent * ev );
    void mouseMoveEvent( QMouseEvent * ev );
    void mouseReleaseEvent( QMouseEvent * );
    void dragEnterEvent( QDragEnterEvent *ev );
    void dropEvent( QDropEvent* ev );

Laurent Montel's avatar
Laurent Montel committed
124
private Q_SLOTS:
George Staikos's avatar
George Staikos committed
125 126
    void delayedOpenURL();

127 128 129 130
private:
    QPoint startDragPos;
    bool validDrag;
    KonqMainWindow * m_mw;
Laurent Montel's avatar
Laurent Montel committed
131
    KUrl::List _savedLst;
132 133
};

134
#endif