|
|
|
|
/***************************************************************************
|
|
|
|
|
smbconfconfigwidget.cpp - description
|
|
|
|
|
-------------------
|
|
|
|
|
begin : Tue May 16 2003
|
|
|
|
|
copyright : (C) 2003 by Jan Sch<EFBFBD>er
|
|
|
|
|
email : janschaefer@users.sourceforge.net
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
|
* *
|
|
|
|
|
* This file is part of KSambaPlugin. *
|
|
|
|
|
* *
|
|
|
|
|
* KSambaPlugin 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. *
|
|
|
|
|
* *
|
|
|
|
|
* KSambaPlugin 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 KSambaPlugin; if not, write to the Free Software *
|
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
|
|
|
|
|
* *
|
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include <tqfileinfo.h>
|
|
|
|
|
#include <tqlayout.h>
|
|
|
|
|
#include <tqpushbutton.h>
|
|
|
|
|
#include <tqlabel.h>
|
|
|
|
|
|
|
|
|
|
#include <tdeapplication.h>
|
|
|
|
|
#include <tdefiledialog.h>
|
|
|
|
|
#include <tdelocale.h>
|
|
|
|
|
#include <tdemessagebox.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "smbconfconfigwidget.h"
|
|
|
|
|
|
|
|
|
|
SmbConfConfigWidget::SmbConfConfigWidget(TQWidget* parent)
|
|
|
|
|
: TQWidget(parent,"configWidget")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
TQVBoxLayout *layout = new TQVBoxLayout(this,5);
|
|
|
|
|
|
|
|
|
|
TQLabel *lbl = new TQLabel(i18n("<p>The SAMBA configuration file <strong>'smb.conf'</strong>" \
|
|
|
|
|
" could not be found;</p>" \
|
|
|
|
|
"make sure you have SAMBA installed.\n\n"), this);
|
|
|
|
|
|
|
|
|
|
TQHBoxLayout *hbox = new TQHBoxLayout(this);
|
|
|
|
|
TQPushButton *btn = new TQPushButton(i18n("Specify Location"), this);
|
|
|
|
|
connect(btn, TQT_SIGNAL(pressed()), this, TQT_SLOT( btnPressed()));
|
|
|
|
|
|
|
|
|
|
btn->setDefault(false);
|
|
|
|
|
btn->setAutoDefault(false);
|
|
|
|
|
|
|
|
|
|
hbox->addStretch();
|
|
|
|
|
hbox->addWidget(btn);
|
|
|
|
|
|
|
|
|
|
layout->addWidget(lbl);
|
|
|
|
|
layout->addLayout(hbox);
|
|
|
|
|
layout->addStretch();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SmbConfConfigWidget::btnPressed() {
|
|
|
|
|
TQString smbConf = KFileDialog::getOpenFileName("/",
|
|
|
|
|
"smb.conf|Samba conf. File\n"
|
|
|
|
|
"*|All Files",0,i18n("Get smb.conf Location"));
|
|
|
|
|
|
|
|
|
|
if (smbConf.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
if ( ! TQFileInfo(smbConf).isReadable() ) {
|
|
|
|
|
KMessageBox::sorry(this,i18n("<qt>The file <i>%1</i> could not be read.</qt>").arg(smbConf),i18n("Could Not Read File"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TDEConfig config("ksambaplugin");
|
|
|
|
|
|
|
|
|
|
config.setGroup("KSambaKonqiPlugin");
|
|
|
|
|
config.writeEntry("smb.conf",smbConf);
|
|
|
|
|
config.sync();
|
|
|
|
|
|
|
|
|
|
emit smbConfChoosed(smbConf);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#include "smbconfconfigwidget.moc"
|