2 KNode, the KDE newsreader
3 Copyright (c) 1999-2005 the KNode authors.
4 See file AUTHORS for details
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 You should have received a copy of the GNU General Public License
11 along with this program; if not, write to the Free Software Foundation,
12 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US
23 //*****************************************************************************
25 //*****************************************************************************
28 /** File save helper (includes file save dialog and network upload). */
33 KNSaveHelper(QString saveName
, QWidget
*parent
);
36 /** returns a file open for writing */
37 QFile
* getFile(const QString
&dialogTitle
);
45 KTemporaryFile
* tmpFile
;
46 static QString lastPath
;
51 //========================================================================================
54 /** File open helper (includes file open dialog and network download). */
59 explicit KNLoadHelper(QWidget
*parent
);
62 /** opens a file dialog and returns a file open for reading */
63 QFile
* getFile( const QString
&dialogTitle
);
64 /** tries to access the file specified by the url and returns
65 a file open for reading */
66 QFile
* setURL(const KUrl
& url
);
67 /** returns the file after getFile(QString) of setURL(url) was called */
68 QFile
* getFile()const { return f_ile
; }
69 KUrl
getURL() const { return u_rl
; }
77 static KUrl l_astPath
;
82 //========================================================================================
85 /** Some static helper methods. */
90 /** list selection dialog, used instead of a popup menu
91 when a select action is called via the keyboard.
92 returns -1 when the user canceled the dialog. */
93 static int selectDialog(QWidget
*parent
, const QString
&caption
, const QStringList
&options
, int initialValue
);
95 static void saveWindowSize(const QString
&name
, const QSize
&s
);
96 static void restoreWindowSize(const QString
&name
, QWidget
*d
, const QSize
&defaultSize
);
98 static const QString
encryptStr(const QString
& aStr
);
99 static const QString
decryptStr(const QString
& aStr
);
101 /** used for rewarping a text when replying to a message or inserting a file into a box */
102 static QString
rewrapStringList(const QStringList
&text
, int wrapAt
, QChar quoteChar
, bool stopAtSig
, bool alwaysSpace
);
104 /** use this for all internal files */
105 static void displayInternalFileError(QWidget
*w
=0);
106 /** use this for all external files */
107 static void displayExternalFileError(QWidget
*w
=0);
108 /** use this for remote files */
109 static void displayRemoteFileError(QWidget
*w
=0);
110 /** use this for error on temporary files */
111 static void displayTempFileError(QWidget
*w
=0);
113 /** Searches for the string from the current file position. Returns -1 if
114 * the string wasn't found.
116 static int findStringInFile( QFile
*file
, const char *str
);