libkonq
knewmenu.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __knewmenu_h
00021 #define __knewmenu_h
00022
00023 #include <tqintdict.h>
00024 #include <tqstringlist.h>
00025
00026 #include <tdeaction.h>
00027 #include <kdialogbase.h>
00028 #include <kurl.h>
00029 #include <libkonq_export.h>
00030
00031 namespace TDEIO { class Job; }
00032
00033 class KDirWatch;
00034 class KLineEdit;
00035 class KURLRequester;
00036 class TQPopupMenu;
00037
00052 class LIBKONQ_EXPORT KNewMenu : public TDEActionMenu
00053 {
00054 Q_OBJECT
00055 public:
00056
00060 KNewMenu( TDEActionCollection * _collec, const char *name=0L );
00061 KNewMenu( TDEActionCollection * _collec, TQWidget *parentWidget, const char *name=0L );
00062 virtual ~KNewMenu();
00063
00068 void setPopupFiles(KURL::List & _files) {
00069 popupFiles = _files;
00070 }
00071 void setPopupFiles(const KURL & _file) {
00072 popupFiles.clear();
00073 popupFiles.append( _file );
00074 }
00075
00076 public slots:
00081 void slotCheckUpToDate( );
00082
00083 protected slots:
00087 void slotNewDir();
00088
00092 void slotNewFile();
00093
00097 void slotFillTemplates();
00098
00099 void slotResult( TDEIO::Job * );
00100
00101 void slotRenamed( TDEIO::Job *, const KURL&, const KURL& );
00102
00103 private:
00104
00108 void fillMenu();
00109
00114 void parseFiles();
00115
00119 void makeMenus();
00120
00128 enum { LINKTOTEMPLATE = 1, TEMPLATE, SEPARATOR };
00129
00130 struct Entry {
00131 TQString text;
00132 TQString filePath;
00133 TQString templatePath;
00134 TQString icon;
00135 int entryType;
00136 TQString comment;
00137 };
00138
00139
00144 static TQValueList<Entry> * s_templatesList;
00145
00146 class KNewMenuPrivate;
00147 KNewMenuPrivate* d;
00148
00154 static int s_templatesVersion;
00155
00160 static bool s_filesParsed;
00161
00162 int menuItemsVersion;
00163
00168 KURL::List popupFiles;
00169
00173 bool m_isURLDesktopFile;
00174 TQString m_linkURL;
00175
00176 static KDirWatch * s_pDirWatch;
00177 };
00178
00185 class KURLDesktopFileDlg : public KDialogBase
00186 {
00187 Q_OBJECT
00188 public:
00189 KURLDesktopFileDlg( const TQString& textFileName, const TQString& textUrl );
00190 KURLDesktopFileDlg( const TQString& textFileName, const TQString& textUrl, TQWidget *parent );
00191 virtual ~KURLDesktopFileDlg() {}
00192
00196 TQString fileName() const;
00200 TQString url() const;
00201
00202 protected slots:
00203 void slotClear();
00204 void slotNameTextChanged( const TQString& );
00205 void slotURLTextChanged( const TQString& );
00206 private:
00207 void initDialog( const TQString& textFileName, const TQString& defaultName, const TQString& textUrl, const TQString& defaultUrl );
00208
00212 KLineEdit *m_leFileName;
00216 KURLRequester *m_urlRequester;
00217
00221 bool m_fileNameEdited;
00222 };
00223
00224 #endif