Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-83933

wrong location of Trash on Ubuntu

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.15.1
    • 5.15.0 Beta4
    • Core: I/O
    • None
    • Ubuntu 20.04 64bit
    • 112c285fcc065d07734b30ba49a62ead3be3d2c4 (qt/qtbase/dev) 8696a2eb073217516c7c4c22437d2e59868e4440 (qt/qtbase/5.15)

    Description

      Qt 5.15 has a new function

      QFile::moveToTrash()

      This however uses wrong trash location on Ubuntu 20.04.

      #include <QDebug> 
      #include <QFile>
      int main() 
      { 
        QString fileName = "a.txt"; 
        { 
          QFile f(fileName); 
          f.open(QFile::WriteOnly); 
        } 
        { 
          QString trashFileName; 
          QFile::moveToTrash(fileName, &trashFileName); 
          qDebug() << trashFileName; 
        } 
      }
      

       
      This moves the file to trash "/home/vlad/.Trash/files/". However when I use the default file manager in Ubuntu, this file manager uses path "/home/vlad/.local/share/Trash/files/". Which is where users of my application would expect the removed files to be. If there are multiple "correct" locations, it would be nice to be able to decide which one we want to use by Qt API.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vhilshei Volker Hilsheimer
            vladimir.kraus Vladimir Kraus
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes