Results 1 to 2 of 2

Thread: File permission QFile::WriteOther on Win Dos

  1. #1
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default File permission QFile::WriteOther on Win Dos

    If I copy a resource file to a tmp cache dir... so...
    MoveAndCopy(QString::fromUtf8(":/images/images/master.sql"),STATIC_TMP_SQL_DUMP);

    after this file is readonly to user....
    How i set write and remove from application? and edit from user?

    Qt Code:
    1. bool Gui_Front::MoveAndCopy(QString file, QString destfile)
    2. {
    3. QFile Image(file);
    4. if (db->is_file(destfile)) {
    5. db->qt_unlink(destfile);
    6. }
    7. if (!Image.copy(destfile)) {
    8. /*QMessageBox::warning( this,tr( "File Error!" ) , tr("Unable to copy a file to.. %1").arg( destfile ));*/
    9. return false;
    10. } else {
    11. QFile Image2(destfile);
    12. Image2.setPermissions(QFile::WriteOther); /* all 0777 */
    13. return true;
    14. }
    15. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    N.B. Canada
    Posts
    47
    Thanked 8 Times in 7 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: File permission QFile::WriteOther on Win Dos

    I dont have Qt here so I can't try it, but I think you need to set all the permissions something like this:

    Qt Code:
    1. Image2.setPermissions(QFile::ReadOwner | QFile::WriteOwner |
    2. QFile::ReadUser | QFile::WriteUser | QFile::ReadGroup |
    3. QFile::WriteGroup | QFile::ReadOther | QFile::WriteOther); /* all 0777 */
    To copy to clipboard, switch view to plain text mode 

    Bojan
    Last edited by jacek; 13th June 2006 at 15:25. Reason: code changed, so it doesn't break the page layout
    The march of progress:
    C:
    printf("%10.2f", x);
    C++:
    cout << setw(10) << setprecision(2) << showpoint << x;
    Java:
    java.text.NumberFormat formatter = java.text.NumberFormat.getNumberInstance();
    formatter.setMinimumFractionDigits(2);
    formatter.setMaximumFractionDigits(2);
    String s = formatter.format(x);
    for (int i = s.length(); i < 10; i++) System.out.print(' ');
    System.out.print(s);

Similar Threads

  1. Draging a non-existing file to the Windows Desktop
    By klaus1111 in forum Qt Programming
    Replies: 13
    Last Post: 20th September 2007, 12:47
  2. QHttp GET File & Password
    By patrik08 in forum Qt Programming
    Replies: 4
    Last Post: 11th June 2006, 14:04
  3. Accessing DTD in an XML file via QtXml module?
    By jorma in forum Qt Programming
    Replies: 1
    Last Post: 6th May 2006, 19:09
  4. create file in another directory
    By raphaelf in forum Qt Programming
    Replies: 3
    Last Post: 16th February 2006, 11:04
  5. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 15:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.