~ubuntu-branches/ubuntu/lucid/lastfm/lucid

« back to all changes in this revision

Viewing changes to src/libLastFmTools/browserthread.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso
  • Date: 2007-12-31 09:49:54 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20071231094954-ix1amvcsj9pk61ya
Tags: 1:1.4.1.57486.dfsg-1ubuntu1
* Merge from Debian unstable (LP: #180254), remaining changes:
  - debian/rules;
    - Added dh_icons
  - Modify Maintainer value to match Debian-Maintainer-Field Spec

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright (C) 2005 - 2007 by                                          *
3
 
 *      Christian Muehlhaeuser, Last.fm Ltd <chris@last.fm>                *
4
 
 *      Erik Jaelevik, Last.fm Ltd <erik@last.fm>                          *
5
 
 *                                                                         *
6
 
 *   This program is free software; you can redistribute it and/or modify  *
7
 
 *   it under the terms of the GNU General Public License as published by  *
8
 
 *   the Free Software Foundation; either version 2 of the License, or     *
9
 
 *   (at your option) any later version.                                   *
10
 
 *                                                                         *
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         *
14
 
 *   GNU General Public License for more details.                          *
15
 
 *                                                                         *
16
 
 *   You should have received a copy of the GNU General Public License     *
17
 
 *   along with this program; if not, write to the                         *
18
 
 *   Free Software Foundation, Inc.,                                       *
19
 
 *   51 Franklin Steet, Fifth Floor, Boston, MA  02111-1307, USA.          *
20
 
 ***************************************************************************/
21
 
 
22
 
#include "browserthread.h"
23
 
#include <QStringList>
24
 
 
25
 
#include <QStringList>
26
 
#include <QProcess>
27
 
 
28
 
#ifdef Q_WS_MAC
29
 
    #include <ApplicationServices/ApplicationServices.h>
30
 
#endif
31
 
 
32
 
#ifdef WIN32
33
 
    #include <windows.h>
34
 
#endif
35
 
 
36
 
 
37
 
void
38
 
BrowserThread::run()
39
 
{
40
 
#if 0
41
 
    #ifdef WIN32
42
 
    WCHAR val[1024];
43
 
    memset( val, 0, 1024 );
44
 
    MultiByteToWideChar( CP_UTF8, 0, m_url.toAscii(), m_url.length(), val, 1024 );
45
 
    ShellExecute( 0, 0, val, NULL, NULL, SW_SHOW );
46
 
    #endif
47
 
 
48
 
    #ifdef Q_WS_MAC
49
 
    ICInstance icInstance;
50
 
    OSType psiSignature = 'Psi ';
51
 
    OSStatus error = ICStart( &icInstance, psiSignature );
52
 
 
53
 
    ConstStr255Param hint( 0x0 );
54
 
    const char* data = m_url.toLocal8Bit().data();
55
 
    long length = m_url.length();
56
 
    long start( 0 );
57
 
    long end( length );
58
 
 
59
 
    ICLaunchURL( icInstance, hint, data, length, &start, &end );
60
 
    ICStop( icInstance );
61
 
    #endif
62
 
 
63
 
    #ifdef Q_WS_X11
64
 
    QString browser = "firefox";
65
 
    QStringList params;
66
 
    params.append( QString( QUrl::toPercentEncoding( m_url ) ) );
67
 
 
68
 
    QStringList options;
69
 
    options = browser.split( " " );
70
 
    if ( options.size() == 0 )
71
 
        options.append( browser );
72
 
 
73
 
    for ( int i = 1; i < options.size(); i++ )
74
 
    {
75
 
        qDebug( QString( "param: " + options.at( i ) ).toLocal8Bit() );
76
 
        params.append( "\"" + options.at( i ) + "\"" );
77
 
    }
78
 
 
79
 
    QProcess::startDetached( options.at( 0 ), params );
80
 
    #endif
81
 
#endif
82
 
}