~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/gui/dialogs/qfiledialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2007-12-05 16:55:12 UTC
  • mto: (15.1.1 lenny) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: james.westby@ubuntu.com-20071205165512-c3cv9dftyc0p12jo
Tags: upstream-4.3.3
ImportĀ upstreamĀ versionĀ 4.3.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
** functionality provided by Qt Designer and its related libraries.
29
29
**
30
30
** Trolltech reserves all rights not expressly granted herein.
31
 
** 
32
 
** Trolltech ASA (c) 2007
33
31
**
34
32
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
35
33
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
496
494
*/
497
495
void QFileDialogPrivate::_q_goToUrl(const QUrl &url)
498
496
{
499
 
    Q_Q(QFileDialog);
500
 
    q->setDirectory(url.toLocalFile());
 
497
    QModelIndex idx = model->index(url.toLocalFile());
 
498
    _q_enterDirectory(idx);
501
499
}
502
500
 
503
501
/*!
555
553
        if (!d->lineEdit()->hasFocus())
556
554
            d->lineEdit()->setText(text);
557
555
    } else {
 
556
        d->qFileDialogUi->listView->selectionModel()->clear();
558
557
        if (!d->lineEdit()->hasFocus())
559
558
            d->lineEdit()->setText(index.data().toString());
560
559
    }
1577
1576
#ifndef QT_NO_MESSAGEBOX
1578
1577
            QString message = tr("%1\nDirectory not found.\nPlease verify the "
1579
1578
                                          "correct directory name was given.");
1580
 
            QMessageBox::warning(this, windowTitle(), info.fileName() + message);
 
1579
            QMessageBox::warning(this, windowTitle(), message.arg(info.fileName()));
1581
1580
#endif // QT_NO_MESSAGEBOX
1582
1581
            return;
1583
1582
        }
1605
1604
 
1606
1605
        // check if we have to ask for permission to overwrite the file
1607
1606
        if (!info.exists() || !confirmOverwrite() || acceptMode() == AcceptOpen) {
 
1607
            emit filesSelected(QStringList(fn));
1608
1608
            QDialog::accept();
1609
1609
#ifndef QT_NO_MESSAGEBOX
1610
1610
        } else {
1613
1613
                                     .arg(info.fileName()),
1614
1614
                                     QMessageBox::Yes | QMessageBox::No, QMessageBox::No)
1615
1615
                == QMessageBox::Yes)
 
1616
                emit filesSelected(QStringList(fn));
1616
1617
                QDialog::accept();
1617
1618
#endif
1618
1619
        }
2247
2248
    if (!button)
2248
2249
        return;
2249
2250
    QModelIndex index = mapToSource(qFileDialogUi->treeView->currentIndex());
 
2251
    if (!index.isValid())
 
2252
        index = mapToSource(qFileDialogUi->treeView->selectionModel()->selectedIndexes().value(0));
 
2253
 
2250
2254
    switch (fileMode) {
2251
2255
    case QFileDialog::DirectoryOnly:
2252
2256
    case QFileDialog::Directory:
2622
2626
#endif
2623
2627
 
2624
2628
    QRegExp re(QLatin1String("[") + QRegExp::escape(sep) + QLatin1String("]"));
2625
 
    QStringList parts = pathCopy.split(re);
2626
2629
 
2627
2630
#ifdef Q_OS_WIN
 
2631
    QStringList parts = pathCopy.split(re, QString::SkipEmptyParts);
2628
2632
    if (!doubleSlash.isEmpty())
2629
2633
        parts[0].prepend(doubleSlash);
2630
2634
#else
 
2635
    QStringList parts = pathCopy.split(re);
2631
2636
    if (path[0] == sep[0]) // read the "/" at the beginning as the split removed it
2632
2637
        parts[0] = sep[0];
2633
2638
#endif