2
KDE Icon Editor - a small graphics drawing program for the KDE
4
Copyright (C) 1998 Thomas Tanghus (tanghus@kde.org)
6
This program is free software; you can redistribute it and/or
7
modify it under the terms of the GNU General Public
8
License as published by the Free Software Foundation; either
9
version 2 of the License, or (at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
General Public License for more details.
16
You should have received a copy of the GNU Library General Public License
17
along with this library; see the file COPYING.LIB. If not, write to
18
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
Boston, MA 02111-1307, USA.
22
#include <qfileinfo.h>
26
#include <kurlcombobox.h>
27
#include <kdiroperator.h>
28
#include "kmidifiledlg.h"
31
KMidiFileDlg::KMidiFileDlg(const QString& dirName, const QString& filter,
32
QWidget *parent, const char *name,
34
: KFileDialog(dirName, filter, parent, name, modal)
36
/* connect(this,SIGNAL(fileSelected(const QString&)),
37
SLOT(playFile(const QString&)));
39
connect(this,SIGNAL(fileHighlighted(const QString&)),
40
SLOT(noteFile(const QString&)));
41
connect(this,SIGNAL(cancelClicked()),
43
//setButtonOKText(i18n("Play"));
44
okButton()->setText(i18n("Play"));
45
//setButtonCancelText(i18n("Close"));
46
cancelButton()->setText(i18n("Close"));
49
void KMidiFileDlg::playFile(const QString& fname)
51
/* fprintf(stderr, "You clicked on %s\n", fname.ascii()); */
54
QString thePath = u.path();
56
if ( u.isLocalFile() ) {
57
if ( QFileInfo(thePath).isDir() ) {
58
setURL( QDir::cleanDirPath( thePath ) );
61
if (!thePath.isNull())
63
kmidi->restartPlayboxWith(thePath);
68
void KMidiFileDlg::noteFile(const QString& fname)
70
// fprintf(stderr, "You selected %s\n", fname.ascii());
75
void KMidiFileDlg::accept()
77
if ( locationEdit->currentText().stripWhiteSpace().isEmpty() )
82
#define ConfigGroup QString::fromLatin1("KFileDialog Settings")
84
void KMidiFileDlg::closeFbox()
86
/* this doesn't appear to work */
87
*lastDirectory = ops->url();
88
KSimpleConfig *c = new KSimpleConfig(QString::fromLatin1("kdeglobals"),
90
saveConfig( c, ConfigGroup );
91
saveRecentFiles( KGlobal::config() );
95
void KMidiFileDlg::getOpenDialog(const QString& dir, const QString& filter,
96
QWidget *parent, const char *name)
98
static KMidiFileDlg *dlg = 0;
101
dlg= new KMidiFileDlg(dir, filter, parent, name, false);
102
dlg->setCaption(i18n("Open"));
108
#include "kmidifiledlg.moc"