Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
KAlarm
Commits
8b8213c4
Commit
8b8213c4
authored
Apr 22, 2012
by
David Jarvie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use previously selected directory as default in sound file picker
parent
28a301ee
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
21 deletions
+21
-21
functions.cpp
functions.cpp
+3
-3
sounddlg.cpp
sounddlg.cpp
+2
-1
sounddlg.h
sounddlg.h
+2
-2
soundpicker.cpp
soundpicker.cpp
+13
-13
soundpicker.h
soundpicker.h
+1
-2
No files found.
functions.cpp
View file @
8b8213c4
...
...
@@ -2130,11 +2130,11 @@ QString browseFile(const QString& caption, QString& defaultDir, const QString& i
if
(
!
initialFile
.
isEmpty
())
fileDlg
->
setSelection
(
initialFile
);
if
(
fileDlg
->
exec
()
!=
QDialog
::
Accepted
)
return
fileDlg
?
QString
(
""
)
:
QString
();
return
fileDlg
?
QString
()
:
QString
();
KUrl
url
=
fileDlg
->
selectedUrl
();
if
(
url
.
isEmpty
())
return
QString
(
""
);
defaultDir
=
url
.
isLocalFile
()
?
url
.
toLocalFile
()
:
url
.
path
();
return
QString
();
defaultDir
=
url
.
isLocalFile
()
?
url
.
upUrl
().
toLocalFile
()
:
url
.
directory
();
return
(
mode
&
KFile
::
LocalOnly
)
?
url
.
pathOrUrl
()
:
url
.
prettyUrl
();
}
...
...
sounddlg.cpp
View file @
8b8213c4
/*
* sounddlg.cpp - sound file selection and configuration dialog and widget
* Program: kalarm
* Copyright © 2005-201
1
by David Jarvie <djarvie@kde.org>
* Copyright © 2005-201
2
by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -137,6 +137,7 @@ void SoundDlg::slotButtonClicked(int button)
= Class SoundWidget
= Select a sound file and configure how to play it.
=============================================================================*/
QString
SoundWidget
::
mDefaultDir
;
SoundWidget
::
SoundWidget
(
bool
showPlay
,
bool
showRepeat
,
QWidget
*
parent
)
:
QWidget
(
parent
),
...
...
sounddlg.h
View file @
8b8213c4
/*
* sounddlg.h - sound file selection and configuration dialog and widget
* Program: kalarm
* Copyright © 2005-2007,2009-201
1
by David Jarvie <djarvie@kde.org>
* Copyright © 2005-2007,2009-201
2
by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -72,6 +72,7 @@ class SoundWidget : public QWidget
void
playFinished
();
private:
static
QString
mDefaultDir
;
// current default directory for mFileEdit
QPushButton
*
mFilePlay
;
LineEdit
*
mFileEdit
;
PushButton
*
mFileBrowseButton
;
...
...
@@ -84,7 +85,6 @@ class SoundWidget : public QWidget
SpinBox
*
mFadeTime
;
KHBox
*
mFadeVolumeBox
;
Slider
*
mFadeSlider
;
QString
mDefaultDir
;
// current default directory for mFileEdit
mutable
KUrl
mUrl
;
mutable
QString
mValidatedFile
;
Phonon
::
MediaObject
*
mPlayer
;
...
...
soundpicker.cpp
View file @
8b8213c4
/*
* soundpicker.cpp - widget to select a sound file or a beep
* Program: kalarm
* Copyright © 2002-201
1
by David Jarvie <djarvie@kde.org>
* Copyright © 2002-201
2
by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -20,6 +20,7 @@
#include "kalarm.h"
#include "autoqpointer.h"
#include "combobox.h"
#include "functions.h"
#include "kalarmapp.h"
...
...
@@ -261,28 +262,27 @@ void SoundPicker::slotTypeSelected(int id)
void
SoundPicker
::
slotPickFile
()
{
KUrl
oldfile
=
mFile
;
KUrl
file
=
mFile
;
SoundDlg
dlg
(
mFile
.
prettyUrl
(),
mVolume
,
mFadeVolume
,
mFadeSeconds
,
mRepeatPause
,
i18nc
(
"@title:window"
,
"Sound File"
),
this
);
dlg
.
setReadOnly
(
mReadOnly
);
bool
accepted
=
(
dlg
.
exec
()
==
QDialog
::
Accepted
);
// Use AutoQPointer to guard against crash on application exit while
// the dialogue is still open. It prevents double deletion (both on
// deletion of EditAlarmDlg, and on return from this function).
AutoQPointer
<
SoundDlg
>
dlg
=
new
SoundDlg
(
mFile
.
prettyUrl
(),
mVolume
,
mFadeVolume
,
mFadeSeconds
,
mRepeatPause
,
i18nc
(
"@title:window"
,
"Sound File"
),
this
);
dlg
->
setReadOnly
(
mReadOnly
);
bool
accepted
=
(
dlg
->
exec
()
==
QDialog
::
Accepted
);
if
(
mReadOnly
)
return
;
if
(
accepted
)
{
float
volume
,
fadeVolume
;
int
fadeTime
;
dlg
.
getVolume
(
volume
,
fadeVolume
,
fadeTime
);
file
=
dlg
.
getFile
();
mRepeatPause
=
dlg
.
repeatPause
();
dlg
->
getVolume
(
volume
,
fadeVolume
,
fadeTime
);
KUrl
file
=
dlg
->
getFile
();
if
(
!
file
.
isEmpty
())
mFile
=
file
;
mRepeatPause
=
dlg
->
repeatPause
();
mVolume
=
volume
;
mFadeVolume
=
fadeVolume
;
mFadeSeconds
=
fadeTime
;
}
if
(
!
file
.
isEmpty
())
{
mFile
=
file
;
mDefaultDir
=
dlg
.
defaultDir
();
}
if
(
mFile
.
isEmpty
())
{
// No audio file is selected, so revert to previously selected option
...
...
soundpicker.h
View file @
8b8213c4
/*
* soundpicker.h - widget to select a sound file or a beep
* Program: kalarm
* Copyright © 2002,2004-201
1
by David Jarvie <djarvie@kde.org>
* Copyright © 2002,2004-201
2
by David Jarvie <djarvie@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -117,7 +117,6 @@ class SoundPicker : public QFrame
ComboBox
*
mTypeCombo
;
KHBox
*
mTypeBox
;
PushButton
*
mFilePicker
;
QString
mDefaultDir
;
KUrl
mFile
;
// sound file to play when alarm is triggered
float
mVolume
;
// volume for file, or < 0 to not set volume
float
mFadeVolume
;
// initial volume for file, or < 0 for no fading
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment