summaryrefslogtreecommitdiffstats
path: root/konqueror/konq_misc.h
blob: bab4ca8536dd412cb583cffda22fabf1a71f9105 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/* 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
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef _konq_misc_h
#define _konq_misc_h

// This file can hold every global class for konqueror that used to pollute
// konq_main.cc

#include <krun.h>
#include <kparts/browserextension.h>
class KonqMainWindow;
class KonqView;

class KonqMisc
{
public:
    /*
    private:
      static KonqFileManager *s_pSelf;
    public:
    KonqFileManager() {}
    ~KonqFileManager() {}

    static KonqFileManager *self()
    {
      if ( !s_pSelf )
      s_pSelf = new KonqFileManager();
      return s_pSelf;
     }
    */

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

    /**
     * Create a new window with a single view, showing @p url
     */
    static KonqMainWindow * createSimpleWindow( const KURL &url, const TQString &frameName = TQString::null );

    /**
     * Create a new window with a single view, showing @p url, using @p args
     */
    static KonqMainWindow * createSimpleWindow( const KURL &url, const KParts::URLArgs &args, 
						bool tempFile = false);

    /**
     * Create a new window for @p url using @p args and the appropriate profile for this URL.
     * @param forbidUseHTML internal. True when called by "Find Files"
     * @param openURL If it is false, no url is openend in the new window. The url is used to guess the profile
     */
    static KonqMainWindow * createNewWindow( const KURL &url,
                                             const KParts::URLArgs &args = KParts::URLArgs(),
                                             bool forbidUseHTML = false,
                                             TQStringList filesToSelect = TQStringList(),
                                             bool tempFile = false,
					     bool openURL = true);

    /**
     * Create a new window from the profile defined by @p filename and @p path.
     * @param url an optionnal URL to open in this profile.
     * @param forbidUseHTML internal. True when called by "Find Files"
     * @param openURL If false no url is opened
     */
    static KonqMainWindow * createBrowserWindowFromProfile( const TQString &path,
                                                            const TQString &filename,
                                                            const KURL &url = KURL(),
                                                            const KParts::URLArgs &args = KParts::URLArgs(),
                                                            bool forbidUseHTML = false,
                                                            const TQStringList& filesToSelect = TQStringList(),
                                                            bool tempFile = false,
							    bool openURL = true);

    /**
     * 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 );

    /**
     * Applies the URI filters to @p url.
     *
     * @p parent is used in case of a message box.
     * @p _url to be filtered.
     * @p _path the absolute path to append to the url before filtering it.
     */
    static TQString konqFilteredURL( TQWidget* /*parent*/, const TQString& /*_url*/, const TQString& _path = TQString::null );

};

#include <tqlabel.h>

class KonqDraggableLabel : public TQLabel
{
    Q_OBJECT
public:
    KonqDraggableLabel( KonqMainWindow * mw, const TQString & text );

protected:
    void mousePressEvent( TQMouseEvent * ev );
    void mouseMoveEvent( TQMouseEvent * ev );
    void mouseReleaseEvent( TQMouseEvent * );
    void dragEnterEvent( TQDragEnterEvent *ev );
    void dropEvent( TQDropEvent* ev );

private slots:
    void delayedOpenURL();

private:
    TQPoint startDragPos;
    bool validDrag;
    KonqMainWindow * m_mw;
    KURL::List _savedLst;
};

#endif