~ubuntu-branches/ubuntu/natty/kdemultimedia/natty-proposed

« back to all changes in this revision

Viewing changes to dragonplayer/src/app/playlistFile.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers
  • Date: 2011-05-26 02:41:36 UTC
  • mfrom: (0.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: james.westby@ubuntu.com-20110526024136-jjwsigfy402jhupm
Tags: upstream-4.6.3
ImportĀ upstreamĀ versionĀ 4.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * published by the Free Software Foundation; either version 2 of
8
8
 * the License or (at your option) version 3 or any later version
9
9
 * accepted by the membership of KDE e.V. (or its successor approved
10
 
 * by the membership of KDE e.V.), which shall act as a proxy 
 
10
 * by the membership of KDE e.V.), which shall act as a proxy
11
11
 * defined in Section 14 of version 3 of the license.
12
12
 *
13
13
 * This program is distributed in the hope that it will be useful,
41
41
 
42
42
    QString &path = m_path = url.path();
43
43
 
44
 
    if( path.endsWith( QString(".pls"), Qt::CaseInsensitive ) )
 
44
    if( path.endsWith( QLatin1String(".pls"), Qt::CaseInsensitive ) )
45
45
        m_type = PLS; else
46
 
    if( path.endsWith( QString(".m3u"), Qt::CaseInsensitive ) )
 
46
    if( path.endsWith( QLatin1String(".m3u"), Qt::CaseInsensitive ) )
47
47
        m_type = M3U;
48
48
    else {
49
49
        m_type = Unknown;
50
50
        m_error = i18n( "The file is not a playlist" );
 
51
        QApplication::restoreOverrideCursor();
51
52
        return;
52
53
    }
53
54
 
55
56
        path.clear();
56
57
        if( !KIO::NetAccess::download( url, path, Dragon::mainWindow() ) ) {
57
58
            m_error = i18n( "Dragon Player could not download the remote playlist: %1", url.prettyUrl() );
 
59
            QApplication::restoreOverrideCursor();
58
60
            return;
59
61
        }
60
62
    }
92
94
 
93
95
    for( QString line = stream.readLine(); !line.isNull(); )
94
96
    {
95
 
        if( line.startsWith( QString("File") ) ) {
96
 
            const KUrl url = line.section( '=', -1 );
97
 
            const QString title = stream.readLine().section( '=', -1 );
 
97
        if( line.startsWith( QLatin1String("File") ) ) {
 
98
            const KUrl url = line.section( QLatin1Char(  '=' ), -1 );
 
99
            const QString title = stream.readLine().section( QLatin1Char(  '=' ), -1 );
98
100
 
99
101
            kDebug() << url << endl << title;
100
102
 
116
118
    {
117
119
        line = stream.readLine();
118
120
 
119
 
        if( line.startsWith( QString("#EXTINF"), Qt::CaseInsensitive ) )
 
121
        if( line.startsWith( QLatin1String("#EXTINF"), Qt::CaseInsensitive ) )
120
122
            continue;
121
123
 
122
 
        else if( !line.startsWith( '#' ) && !line.isEmpty() )
 
124
        else if( !line.startsWith( QLatin1Char( '#' ) ) && !line.isEmpty() )
123
125
        {
124
126
            KUrl url;
125
127
 
126
128
            // KUrl::isRelativeUrl() expects absolute URLs to start with a protocol, so prepend it if missing
127
 
            if( line.startsWith( '/' ) )
128
 
                line.prepend( "file://" );
 
129
            if( line.startsWith( QLatin1Char( '/' ) ) )
 
130
                line.prepend( QLatin1String( "file://" ) );
129
131
 
130
132
            if( KUrl::isRelativeUrl( line ) )
131
 
                url.setPath( m_url.directory() + '/' + line );
 
133
                url.setPath( m_url.directory() + QLatin1Char( '/' ) + line );
132
134
            else
133
135
                url = KUrl( line );
134
136