Ticket #3268: qt_fixFileDialog.patch

File qt_fixFileDialog.patch, 3.0 KB (added by Longinus00, 12 years ago)
  • qt/mainwin.cc

    diff --git qt/mainwin.cc qt/mainwin.cc
    index de29d25..5a10e32 100644
    TrMainWindow :: TrMainWindow( Session& session, Prefs& prefs, TorrentModel& mode 
    9090    myAboutDialog( new AboutDialog( this ) ),
    9191    myStatsDialog( new StatsDialog( session, this ) ),
    9292    myDetailsDialog( 0 ),
    93     myFileDialog( 0 ),
    9493    myFilterModel( prefs ),
    9594    myTorrentDelegate( new TorrentDelegate( this ) ),
    9695    myTorrentDelegateMin( new TorrentDelegateMin( this ) ),
    TrMainWindow :: newTorrent( ) 
    11121111void
    11131112TrMainWindow :: openTorrent( )
    11141113{
    1115     if( myFileDialog == 0 )
    1116     {
    1117         myFileDialog = new QFileDialog( this,
    1118                                         tr( "Add Torrent" ),
    1119                                         myPrefs.getString( Prefs::OPEN_DIALOG_FOLDER ),
    1120                                         tr( "Torrent Files (*.torrent);;All Files (*.*)" ) );
    1121         myFileDialog->setFileMode( QFileDialog::ExistingFiles );
    1122 
    1123 
    1124         QCheckBox * button = new QCheckBox( tr( "Show &options dialog" ) );
    1125         button->setChecked( myPrefs.getBool( Prefs::OPTIONS_PROMPT ) );
    1126         QGridLayout * layout = dynamic_cast<QGridLayout*>(myFileDialog->layout());
    1127         layout->addWidget( button, layout->rowCount( ), 0, 1, -1, Qt::AlignLeft );
    1128         myFileDialogOptionsCheck = button;
    1129 
    1130         connect( myFileDialog, SIGNAL(filesSelected(const QStringList&)),
    1131                  this, SLOT(addTorrents(const QStringList&)));
    1132     }
     1114    QFileDialog * myFileDialog;
     1115    myFileDialog = new QFileDialog( this,
     1116                                    tr( "Add Torrent" ),
     1117                                    myPrefs.getString( Prefs::OPEN_DIALOG_FOLDER ),
     1118                                    tr( "Torrent Files (*.torrent);;All Files (*.*)" ) );
     1119    myFileDialog->setFileMode( QFileDialog::ExistingFiles );
     1120
     1121    QCheckBox * button = new QCheckBox( tr( "Show &options dialog" ) );
     1122    button->setChecked( myPrefs.getBool( Prefs::OPTIONS_PROMPT ) );
     1123    QGridLayout * layout = dynamic_cast<QGridLayout*>(myFileDialog->layout());
     1124    layout->addWidget( button, layout->rowCount( ), 0, 1, -1, Qt::AlignLeft );
     1125    myFileDialogOptionsCheck = button;
     1126
     1127    connect( myFileDialog, SIGNAL(filesSelected(const QStringList&)),
     1128             this, SLOT(addTorrents(const QStringList&)));
    11331129
    11341130    myFileDialog->show( );
    11351131}
  • qt/mainwin.h

    diff --git qt/mainwin.h qt/mainwin.h
    index e18f668..85a83b5 100644
     
    1515
    1616#include <ctime>
    1717#include <QCheckBox>
    18 #include <QFileDialog>
    1918#include <QLineEdit>
    2019#include <QIcon>
    2120#include <QMainWindow>
    2221#include <QMap>
     22#include <QPushButton>
    2323#include <QSet>
    2424#include <QSystemTrayIcon>
    2525#include <QTimer>
    class TrMainWindow: public QMainWindow 
    6060        QDialog * myAboutDialog;
    6161        QDialog * myStatsDialog;
    6262        Details * myDetailsDialog;
    63         QFileDialog * myFileDialog;
    6463        QCheckBox * myFileDialogOptionsCheck;
    6564        QSystemTrayIcon myTrayIcon;
    6665        TorrentFilter myFilterModel;