VirtualBox

Changeset 58607 in vbox


Ignore:
Timestamp:
Nov 6, 2015 2:40:24 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8104: LogWindow: Fix for logwindow fails to save over the existing file when user chooses replace option. It should fix ticketref:8034:

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/UIVMLogViewer.cpp

    r58267 r58607  
    3232
    3333/* GUI includes: */
     34# include "QIFileDialog.h"
     35# include "QITabWidget.h"
     36# include "UIExtraDataManager.h"
     37# include "UIIconPool.h"
     38# include "UIMessageCenter.h"
     39# include "UISpecialControls.h"
    3440# include "UIVMLogViewer.h"
    35 # include "QITabWidget.h"
    36 # include "UIIconPool.h"
    37 # include "UISpecialControls.h"
    3841# include "VBoxGlobal.h"
    39 # include "UIMessageCenter.h"
    4042# include "VBoxUtils.h"
    41 # include "UIExtraDataManager.h"
    4243
    4344/* COM includes: */
     
    790791{
    791792    /* Prepare "save as" dialog: */
    792     QFileInfo fileInfo(m_book.at(m_pViewerContainer->currentIndex()).first);
    793     QDateTime dtInfo = fileInfo.lastModified();
    794     QString strDtString = dtInfo.toString("yyyy-MM-dd-hh-mm-ss");
    795     QString strDefaultFileName = QString("%1-%2.log").arg(m_machine.GetName()).arg(strDtString);
    796     QString strDefaultFullName = QDir::toNativeSeparators(QDir::home().absolutePath() + "/" + strDefaultFileName);
    797     QString strNewFileName = QFileDialog::getSaveFileName(this, tr("Save VirtualBox Log As"), strDefaultFullName);
    798 
    799     /* Copy log into the file: */
     793    const QFileInfo fileInfo(m_book.at(m_pViewerContainer->currentIndex()).first);
     794    /* Prepare default filename: */
     795    const QDateTime dtInfo = fileInfo.lastModified();
     796    const QString strDtString = dtInfo.toString("yyyy-MM-dd-hh-mm-ss");
     797    const QString strDefaultFileName = QString("%1-%2.log").arg(m_machine.GetName()).arg(strDtString);
     798    const QString strDefaultFullName = QDir::toNativeSeparators(QDir::home().absolutePath() + "/" + strDefaultFileName);
     799    /* Show "save as" dialog: */
     800    const QString strNewFileName = QIFileDialog::getSaveFileName(strDefaultFullName,
     801                                                                 "",
     802                                                                 this,
     803                                                                 tr("Save VirtualBox Log As"),
     804                                                                 0 /* selected filter */,
     805                                                                 true /* resolve symlinks */,
     806                                                                 true /* confirm overwrite */);
     807    /* Make sure file-name is not empty: */
    800808    if (!strNewFileName.isEmpty())
     809    {
     810        /* Delete the previous file if already exists as user already confirmed: */
     811        if (QFile::exists(strNewFileName))
     812            QFile::remove(strNewFileName);
     813        /* Copy log into the file: */
    801814        QFile::copy(m_machine.QueryLogFilename(m_pViewerContainer->currentIndex()), strNewFileName);
     815    }
    802816}
    803817
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette