[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/kalarm
From:       David Jarvie <djarvie () kde ! org>
Date:       2009-11-12 21:36:00
Message-ID: 1258061760.496579.19373.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1048189 by djarvie:

Audio alarm fixes: implement drag-and-drop, etc.


 M  +4 -3      editdlgtypes.cpp  
 M  +3 -0      functions.cpp  
 M  +3 -1      mainwindow.cpp  
 M  +10 -1     sounddlg.cpp  
 M  +1 -1      sounddlg.h  


--- trunk/KDE/kdepim/kalarm/editdlgtypes.cpp #1048188:1048189
@@ -1488,7 +1488,7 @@
 	else
 	{
 		// Set the values to their defaults
-		mSoundConfig->set(Preferences::defaultSoundFile(), Preferences::defaultSoundVolume(), -1, 0, false);
+		mSoundConfig->set(Preferences::defaultSoundFile(), Preferences::defaultSoundVolume());
 	}
 }
 
@@ -1497,15 +1497,16 @@
 */
 void EditAudioAlarmDlg::setAudio(const QString& file, float volume)
 {
-	mSoundConfig->set(file, volume, -1, 0, false);
+	mSoundConfig->set(file, volume);
 }
 
 /******************************************************************************
 * Set the dialog's action and the action's text.
 */
-void EditAudioAlarmDlg::setAction(KAEventData::Action action, const AlarmText&)
+void EditAudioAlarmDlg::setAction(KAEventData::Action action, const AlarmText& alarmText)
 {
 	Q_ASSERT(action == KAEventData::AUDIO);
+	mSoundConfig->set(alarmText.displayText(), Preferences::defaultSoundVolume());
 }
 
 /******************************************************************************
--- trunk/KDE/kdepim/kalarm/functions.cpp #1048188:1048189
@@ -903,6 +903,9 @@
 		case KAEventData::EMAIL:
 			type = EditAlarmDlg::EMAIL;
 			break;
+		case KAEventData::AUDIO:
+			type = EditAlarmDlg::AUDIO;
+			break;
 		default:
 			return;
 	}
--- trunk/KDE/kdepim/kalarm/mainwindow.cpp #1048188:1048189
@@ -1319,7 +1319,9 @@
 	else if (!(files = KUrl::List::fromMimeData(data)).isEmpty())
 	{
 		kDebug() << "URL";
-		action = KAEventData::FILE;
+		// Try to find the mime type of the file, without downloading a remote file
+		KMimeType::Ptr mimeType = KMimeType::findByUrl(files[0]);
+		action = mimeType->name().startsWith("audio/") ? KAEventData::AUDIO : KAEventData::FILE;
 		alarmText.setText(files[0].prettyUrl());
 	}
 	else if (data->hasText())
--- trunk/KDE/kdepim/kalarm/sounddlg.cpp #1048188:1048189
@@ -140,6 +140,13 @@
 	layout->setMargin(0);
 	layout->setSpacing(KDialog::spacingHint());
 
+	QLabel* label = 0;
+	if (!showPlay)
+	{
+		label = new QLabel(i18nc("@label", "Sound file:"), this);
+		layout->addWidget(label);
+	}
+
 	KHBox* box = new KHBox(this);
 	box->setMargin(0);
 	layout->addWidget(box);
@@ -158,6 +165,8 @@
 	mFileEdit = new LineEdit(LineEdit::Url, box);
 	mFileEdit->setAcceptDrops(true);
 	mFileEdit->setWhatsThis(i18nc("@info:whatsthis", "Enter the name or URL of a sound file to play."));
+	if (label)
+		label->setBuddy(mFileEdit);
 	connect(mFileEdit, SIGNAL(textChanged(const QString&)), SIGNAL(changed()));
 
 	// File browse button
@@ -228,7 +237,7 @@
 	mFadeBox->setMargin(0);
 	mFadeBox->setSpacing(KDialog::spacingHint());
 	grid->addWidget(mFadeBox, 3, 2, Qt::AlignLeft);
-	QLabel* label = new QLabel(i18nc("@label:spinbox Time period over which to fade the sound", "Fade time:"), mFadeBox);
+	label = new QLabel(i18nc("@label:spinbox Time period over which to fade the sound", "Fade time:"), mFadeBox);
 	label->setFixedSize(label->sizeHint());
 	mFadeTime = new SpinBox(1, 999, mFadeBox);
 	mFadeTime->setSingleShiftStep(10);
--- trunk/KDE/kdepim/kalarm/sounddlg.h #1048188:1048189
@@ -44,7 +44,7 @@
 	public:
 		SoundWidget(bool showPlay, bool showRepeat, QWidget* parent);
 		~SoundWidget();
-		void           set(const QString& file, float volume, float fadeVolume, int fadeSeconds, bool repeat);
+		void           set(const QString& file, float volume, float fadeVolume = -1, int fadeSeconds = 0, bool repeat = false);
 		void           setReadOnly(bool);
 		bool           isReadOnly() const    { return mReadOnly; }
 		QString        fileName() const;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic