Changeset 14497


Ignore:
Timestamp:
Apr 15, 2015, 12:08:24 AM (6 years ago)
Author:
mikedld
Message:

Use native separators for path button and free space label tooltips. Improve path button dialog initial directory/file selection.

Location:
trunk/qt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/freespace-label.cc

    r14466 r14497  
    77 * $Id$
    88 */
     9
     10#include <QDir>
    911
    1012#include <libtransmission/transmission.h>
     
    99101  tr_variantDictFindStr (arguments, TR_KEY_path, &path, &len);
    100102  str = QString::fromUtf8 (path, len);
    101   setToolTip (str);
     103  setToolTip (QDir::toNativeSeparators (str));
    102104
    103105  myTimer.start ();
  • trunk/qt/path-button.cc

    r14462 r14497  
    99
    1010#include <QApplication>
     11#include <QDir>
    1112#include <QFileDialog>
    1213#include <QFileIconProvider>
     
    6465    return;
    6566
    66   myPath = Utils::removeTrailingDirSeparator (path);
     67  myPath = QDir::toNativeSeparators (Utils::removeTrailingDirSeparator (path));
    6768
    6869  updateAppearance ();
     
    115116  if (!myNameFilter.isEmpty ())
    116117    dialog->setNameFilter (myNameFilter);
    117   dialog->selectFile (myPath);
     118
     119  const QFileInfo pathInfo (myPath);
     120  if (!myPath.isEmpty () && pathInfo.exists ())
     121    {
     122      if (pathInfo.isDir ())
     123        {
     124          dialog->setDirectory (pathInfo.absoluteFilePath ());
     125        }
     126      else
     127        {
     128          dialog->setDirectory (pathInfo.absolutePath ());
     129          dialog->selectFile (pathInfo.fileName ());
     130        }
     131    }
    118132
    119133  connect (dialog, SIGNAL (fileSelected (QString)), this, SLOT (onFileSelected (QString)));
Note: See TracChangeset for help on using the changeset viewer.