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 #include "PreCompiled.h" 00025 #ifndef _PreComp_ 00026 # include <QMessageBox> 00027 # include <QDir> 00028 #endif 00029 00030 #include "DlgOnlineHelpImp.h" 00031 #include "PrefWidgets.h" 00032 00033 #include <Base/Parameter.h> 00034 #include <App/Application.h> 00035 00036 using namespace Gui::Dialog; 00037 00038 /* TRANSLATOR Gui::Dialog::DlgOnlineHelpImp */ 00039 00047 DlgOnlineHelpImp::DlgOnlineHelpImp( QWidget* parent ) 00048 : PreferencePage(parent) 00049 { 00050 this->setupUi(this); 00051 00052 prefStartPage->setFilter( tr("HTML files (*.html *.htm)") ); 00053 if (prefStartPage->fileName().isEmpty()) { 00054 prefStartPage->setFileName(getStartpage()); 00055 } 00056 } 00057 00061 DlgOnlineHelpImp::~DlgOnlineHelpImp() 00062 { 00063 } 00064 00071 QString DlgOnlineHelpImp::getStartpage() 00072 { 00073 QDir docdir = QDir(QString::fromUtf8(App::Application::getHelpDir().c_str())); 00074 return docdir.absoluteFilePath(QString::fromUtf8("Start_Page.html")); 00075 } 00076 00077 void DlgOnlineHelpImp::saveSettings() 00078 { 00079 prefStartPage->onSave(); 00080 } 00081 00082 void DlgOnlineHelpImp::loadSettings() 00083 { 00084 prefStartPage->onRestore(); 00085 } 00086 00090 void DlgOnlineHelpImp::changeEvent(QEvent *e) 00091 { 00092 if (e->type() == QEvent::LanguageChange) { 00093 retranslateUi(this); 00094 } 00095 else { 00096 QWidget::changeEvent(e); 00097 } 00098 } 00099 00100 void DlgOnlineHelpImp::on_lineEditDownload_fileNameSelected( const QString& url ) 00101 { 00102 QDir dir(url); 00103 if (dir.exists() && dir.count() == 0) { 00104 QMessageBox::critical(this, tr("Access denied"), tr("Access denied to '%1'\n\n" 00105 "Specify another directory, please.").arg(url)); 00106 } 00107 } 00108 00109 #include "moc_DlgOnlineHelpImp.cpp"