00001 /*************************************************************************** 00002 * Copyright (c) 2004 Werner Mayer <wmayer[at]users.sourceforge.net> * 00003 * * 00004 * This file is part of the FreeCAD CAx development system. * 00005 * * 00006 * This library is free software; you can redistribute it and/or * 00007 * modify it under the terms of the GNU Library General Public * 00008 * License as published by the Free Software Foundation; either * 00009 * version 2 of the License, or (at your option) any later version. * 00010 * * 00011 * This library is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU Library General Public License for more details. * 00015 * * 00016 * You should have received a copy of the GNU Library General Public * 00017 * License along with this library; see the file COPYING.LIB. If not, * 00018 * write to the Free Software Foundation, Inc., 59 Temple Place, * 00019 * Suite 330, Boston, MA 02111-1307, USA * 00020 * * 00021 ***************************************************************************/ 00022 00023 00024 #ifndef GUI_NETWORKRETRIEVER_H 00025 #define GUI_NETWORKRETRIEVER_H 00026 00027 #include <QProcess> 00028 00029 #include "Command.h" 00030 00031 00032 namespace Gui { 00033 00040 class NetworkRetriever : public QObject 00041 { 00042 Q_OBJECT 00043 00044 public: 00045 NetworkRetriever( QObject * parent = 0 ); 00046 virtual ~NetworkRetriever(); 00047 00048 void setNumberOfTries( int ); 00049 void setOutputFile( const QString& ); 00050 void setEnableTimestamp(bool); 00051 void setProxy( const QString&, const QString& = QString::null, const QString& = QString::null ); 00052 void setEnableRecursive( bool, int = 0 ); 00053 void setFollowRelative( bool ); 00054 void setEnableConvert( bool ); 00055 void setFetchImages( bool ); 00056 void setEnableHTMLExtension( bool ); 00057 void setNoParent( bool ); 00058 00059 void setOutputDirectory( const QString& ); 00060 bool startDownload( const QString& ); 00061 bool isDownloading() const; 00062 void abort(); 00063 00064 static bool testWget(); 00065 00066 Q_SIGNALS: 00067 void wgetExited(); 00068 00069 private Q_SLOTS: 00070 void testFailure(); 00071 void wgetFinished(int, QProcess::ExitStatus); 00072 00073 private: 00074 QProcess* wget; 00075 struct NetworkRetrieverP* d; 00076 }; 00077 00078 // -------------------------------------------------------------------- 00079 00080 class StdCmdDownloadOnlineHelp : public QObject, public Command 00081 { 00082 Q_OBJECT 00083 00084 public: 00085 StdCmdDownloadOnlineHelp(QObject * parent = 0); 00086 virtual ~StdCmdDownloadOnlineHelp(); 00088 virtual void languageChange(); 00089 00090 protected: 00091 virtual void activated(int iMsg); 00092 00094 virtual Action* createAction(); 00095 00096 private Q_SLOTS: 00097 void wgetFinished(); 00098 00099 private: 00100 NetworkRetriever* wget; 00101 }; 00102 00103 } // namespace Gui 00104 00105 #endif // GUI_NETWORKRETRIEVER_H