[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [Amarok] automount iphone
From: Martin Aumueller <aumuell () reserv ! at>
Date: 2009-08-04 21:11:15
Message-ID: 200908050109.n75194ZN025928 () Wurst ! kollide ! net
[Download RAW message or body]
commit ccb4a1f032f2fb7c4edcd89a655c60ad2b80f92f
Author: Martin Aumueller <aumuell@reserv.at>
AuthorDate: Fri Jul 31 17:56:59 2009 +0200
Commit: Martin Aumueller <aumuell@reserv.at>
CommitDate: Tue Aug 4 23:05:02 2009 +0200
automount iphone
diff --git a/src/collection/ipodcollection/handler/IpodHandler.cpp \
b/src/collection/ipodcollection/handler/IpodHandler.cpp index a603c87..8c0bbe8 100644
--- a/src/collection/ipodcollection/handler/IpodHandler.cpp
+++ b/src/collection/ipodcollection/handler/IpodHandler.cpp
@@ -46,6 +46,7 @@ extern "C" {
#include "kjob.h"
#include <KMessageBox>
#include <KPasswordDialog>
+#include <KStandardDirs>
#include <KUrl>
#include <threadweaver/ThreadWeaver.h>
@@ -116,9 +117,32 @@ IpodHandler::init()
{
if( m_mountPoint.isEmpty() )
{
- debug() << "Error: empty mountpoint, probably an unmounted iPod, aborting";
- m_memColl->slotAttemptConnectionDone( false );
- return;
+ debug() << "Error: empty mountpoint, probably an unmounted iPod/iPhone, \
trying to mount"; + m_mountPoint = KStandardDirs::locateLocal( "tmp", \
"amarok/" ); + QString udi = m_memColl->udi().replace(QChar('/'), QChar('-'));
+ while( udi.startsWith('-') )
+ udi = udi.mid(1);
+ m_mountPoint += udi;
+
+ QDir mp(m_mountPoint);
+ if(!mp.exists())
+ {
+ mp.mkpath(m_mountPoint);
+ debug() << "created " << m_mountPoint;
+ }
+
+ QString command = QString("mount.fuse.ifuse %1 %2").arg(udi, m_mountPoint);
+ debug() << "mountpoint: " << m_mountPoint;
+ debug() << "command: " << command;
+ int result = QProcess::execute(command);
+
+ debug() << "mounting" << (result ? "failed" : "worked");
+
+ if( result )
+ {
+ m_memColl->slotAttemptConnectionDone( false );
+ return;
+ }
}
@@ -313,8 +337,15 @@ IpodHandler::init()
if ( device.isValid() )
{
Solid::StorageAccess *storage = device.as<Solid::StorageAccess>();
- m_filepath = storage->filePath();
- m_capacity = KDiskFreeSpaceInfo::freeSpaceInfo( m_filepath ).size();
+ if ( storage )
+ m_filepath = storage->filePath();
+ else if ( !m_mountPoint.isEmpty() )
+ m_filepath = m_mountPoint;
+
+ if ( !m_filepath.isEmpty() )
+ m_capacity = KDiskFreeSpaceInfo::freeSpaceInfo( m_filepath ).size();
+ else
+ m_capacity = 0.0;
}
else
{
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic