diff --git a/trunk/dlgreportviewer.cpp b/trunk/dlgreportviewer.cpp index 9eaf6f4..21e58d5 100644 --- a/trunk/dlgreportviewer.cpp +++ b/trunk/dlgreportviewer.cpp @@ -1,88 +1,88 @@ /******************************************************************************* * fred Copyright (c) 2011 by Gillen Daniel * * * * Forensic Registry EDitor (fred) is a cross-platform M$ registry hive editor * * with special feautures useful during forensic analysis. * * * * This program is free software: you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the Free * * Software Foundation, either version 3 of the License, or (at your option) * * any later version. * * * * This program is distributed in the hope that it will be useful, but WITHOUT * * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * * more details. * * * * You should have received a copy of the GNU General Public License along with * * this program. If not, see . * *******************************************************************************/ #include "dlgreportviewer.h" #include "ui_dlgreportviewer.h" #include #include DlgReportViewer::DlgReportViewer(QString &report_data, QWidget *p_parent) - : QMainWindow(p_parent,Qt::Dialog), ui(new Ui::DlgReportViewer) + : QMainWindow(p_parent,Qt::Dialog | Qt::Popup), ui(new Ui::DlgReportViewer) { // Init local vars ui->setupUi(this); this->p_local_event_loop=NULL; // Set report content this->ui->WebView->setHtml(report_data); // Set dialog title based on report content title QString report_title=this->ui->WebView->title(); if(report_title.isEmpty()) this->setWindowTitle("Report Viewer"); else this->setWindowTitle(report_title.prepend("Report Viewer : ")); } DlgReportViewer::~DlgReportViewer() { delete ui; if(this->p_local_event_loop!=NULL) this->p_local_event_loop->exit(); } void DlgReportViewer::changeEvent(QEvent *e) { QMainWindow::changeEvent(e); switch(e->type()) { case QEvent::LanguageChange: ui->retranslateUi(this); break; default: break; } } void DlgReportViewer::closeEvent(QCloseEvent *event) { // Make sure we exit the local event loop on exit if(this->p_local_event_loop!=NULL) { this->p_local_event_loop->exit(); this->p_local_event_loop=NULL; } event->accept(); } void DlgReportViewer::exec() { // Create local event loop this->p_local_event_loop=new QEventLoop(this); // Show window and enter loop this->show(); this->p_local_event_loop->exec(); } void DlgReportViewer::on_action_Print_triggered() { // Print report QPrinter printer; QPrintDialog *p_dlg_print=new QPrintDialog(&printer); if(p_dlg_print->exec()==QDialog::Accepted) { this->ui->WebView->print(&printer); } delete p_dlg_print; } void DlgReportViewer::on_action_Close_triggered() { this->close(); } diff --git a/trunk/hivex/lib/byte_conversions.h b/trunk/hivex/lib/byte_conversions.h index aa4ffe6..2e4cafe 100644 --- a/trunk/hivex/lib/byte_conversions.h +++ b/trunk/hivex/lib/byte_conversions.h @@ -1,87 +1,87 @@ /* Useful byte conversion macros, not available on all platforms. * Copyright (C) 2009-2010 Red Hat Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ #ifndef hivex_byteorder_h #define hivex_byteorder_h #ifdef HAVE_ENDIAN_H #include #endif #include #if __BYTE_ORDER == __LITTLE_ENDIAN #ifndef be32toh -#define be32toh(x) __bswap_32 (x) +#define be32toh(x) bswap_32 (x) #endif #ifndef htobe32 -#define htobe32(x) __bswap_32 (x) +#define htobe32(x) bswap_32 (x) #endif #ifndef be64toh -#define be64toh(x) __bswap_64 (x) +#define be64toh(x) bswap_64 (x) #endif #ifndef htobe64 -#define htobe64(x) __bswap_64 (x) +#define htobe64(x) bswap_64 (x) #endif #ifndef le16toh #define le16toh(x) (x) #endif #ifndef htole16 #define htole16(x) (x) #endif #ifndef le32toh #define le32toh(x) (x) #endif #ifndef htole32 #define htole32(x) (x) #endif #ifndef le64toh #define le64toh(x) (x) #endif #ifndef htole64 #define htole64(x) (x) #endif #else /* __BYTE_ORDER == __BIG_ENDIAN */ #ifndef be32toh #define be32toh(x) (x) #endif #ifndef htobe32 #define htobe32(x) (x) #endif #ifndef be64toh #define be64toh(x) (x) #endif #ifndef htobe64 #define htobe64(x) (x) #endif #ifndef le16toh -#define le16toh(x) __bswap_16 (x) +#define le16toh(x) bswap_16 (x) #endif #ifndef htole16 -#define htole16(x) __bswap_16 (x) +#define htole16(x) bswap_16 (x) #endif #ifndef le32toh -#define le32toh(x) __bswap_32 (x) +#define le32toh(x) bswap_32 (x) #endif #ifndef htole32 -#define htole32(x) __bswap_32 (x) +#define htole32(x) bswap_32 (x) #endif #ifndef le64toh -#define le64toh(x) __bswap_64 (x) +#define le64toh(x) bswap_64 (x) #endif #ifndef htole64 -#define htole64(x) __bswap_64 (x) +#define htole64(x) bswap_64 (x) #endif #endif /* __BYTE_ORDER == __BIG_ENDIAN */ #endif /* hivex_byteorder_h */ diff --git a/trunk/hivex_patches/byte_conversions.patch b/trunk/hivex_patches/byte_conversions.patch new file mode 100644 index 0000000..467a35d --- /dev/null +++ b/trunk/hivex_patches/byte_conversions.patch @@ -0,0 +1,54 @@ +diff --git a/lib/byte_conversions.h b/lib/byte_conversions.h +index aa4ffe6..2e4cafe 100644 +--- a/lib/byte_conversions.h ++++ b/lib/byte_conversions.h +@@ -22,16 +22,16 @@ + + #if __BYTE_ORDER == __LITTLE_ENDIAN + #ifndef be32toh +-#define be32toh(x) __bswap_32 (x) ++#define be32toh(x) bswap_32 (x) + #endif + #ifndef htobe32 +-#define htobe32(x) __bswap_32 (x) ++#define htobe32(x) bswap_32 (x) + #endif + #ifndef be64toh +-#define be64toh(x) __bswap_64 (x) ++#define be64toh(x) bswap_64 (x) + #endif + #ifndef htobe64 +-#define htobe64(x) __bswap_64 (x) ++#define htobe64(x) bswap_64 (x) + #endif + #ifndef le16toh + #define le16toh(x) (x) +@@ -65,22 +65,22 @@ + #define htobe64(x) (x) + #endif + #ifndef le16toh +-#define le16toh(x) __bswap_16 (x) ++#define le16toh(x) bswap_16 (x) + #endif + #ifndef htole16 +-#define htole16(x) __bswap_16 (x) ++#define htole16(x) bswap_16 (x) + #endif + #ifndef le32toh +-#define le32toh(x) __bswap_32 (x) ++#define le32toh(x) bswap_32 (x) + #endif + #ifndef htole32 +-#define htole32(x) __bswap_32 (x) ++#define htole32(x) bswap_32 (x) + #endif + #ifndef le64toh +-#define le64toh(x) __bswap_64 (x) ++#define le64toh(x) bswap_64 (x) + #endif + #ifndef htole64 +-#define htole64(x) __bswap_64 (x) ++#define htole64(x) bswap_64 (x) + #endif + #endif /* __BYTE_ORDER == __BIG_ENDIAN */ + diff --git a/trunk/registrykeytable.cpp b/trunk/registrykeytable.cpp index 68fe059..ad65f73 100644 --- a/trunk/registrykeytable.cpp +++ b/trunk/registrykeytable.cpp @@ -1,128 +1,129 @@ /******************************************************************************* * fred Copyright (c) 2011 by Gillen Daniel * * * * Forensic Registry EDitor (fred) is a cross-platform M$ registry hive editor * * with special feautures useful during forensic analysis. * * * * This program is free software: you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the Free * * Software Foundation, either version 3 of the License, or (at your option) * * any later version. * * * * This program is distributed in the hope that it will be useful, but WITHOUT * * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * * more details. * * * * You should have received a copy of the GNU General Public License along with * * this program. If not, see . * *******************************************************************************/ #include "registrykeytable.h" #include #include #include RegistryKeyTable::RegistryKeyTable(QWidget *p_parent) : QTableView(p_parent) { // Configure widget this->setSelectionMode(QAbstractItemView::SingleSelection); this->setSelectionBehavior(QAbstractItemView::SelectRows); this->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); this->verticalHeader()->setHidden(true); + this->setTextElideMode(Qt::ElideNone); // Create context menu this->p_menu_copy=new QMenu(tr("Copy"),this); this->p_action_copy_key_name=new QAction(tr("Key name"), this->p_menu_copy); this->p_menu_copy->addAction(this->p_action_copy_key_name); this->connect(this->p_action_copy_key_name, SIGNAL(triggered()), this, SLOT(SlotCopyKeyName())); this->p_action_copy_key_value=new QAction(tr("Key value"), this->p_menu_copy); this->p_menu_copy->addAction(this->p_action_copy_key_value); this->connect(this->p_action_copy_key_value, SIGNAL(triggered()), this, SLOT(SlotCopyKeyValue())); } RegistryKeyTable::~RegistryKeyTable() { // Delete context menu delete this->p_action_copy_key_name; delete this->p_action_copy_key_value; delete this->p_menu_copy; } void RegistryKeyTable::setModel(QAbstractItemModel *p_model) { QTableView::setModel(p_model); // Resize table rows / columns to fit data this->resizeColumnsToContents(); this->resizeRowsToContents(); this->horizontalHeader()->stretchLastSection(); } /* void RegistryKeyTable::selectRow(QString key_name) { int i; this->clearSelection(); for(i=0;imodel()->rowCount();i++) { if(this->model()) } } */ int RegistryKeyTable::sizeHintForColumn(int column) const { int size_hint=-1; int i=0; int item_width=0; QFontMetrics fm(this->fontMetrics()); QModelIndex idx; if(this->model()==NULL) return -1; // Find string that needs the most amount of space idx=this->model()->index(i,column); while(idx.isValid()) { item_width=fm.width(this->model()->data(idx).toString())+10; if(item_width>size_hint) size_hint=item_width; idx=this->model()->index(++i,column); } return size_hint; } void RegistryKeyTable::contextMenuEvent(QContextMenuEvent *p_event) { // Only show context menu when a row is selected if(this->selectedIndexes().count()!=3) return; // Only show context menu when user clicked on selected row if(!(this->indexAt(p_event->pos())==this->selectedIndexes().at(0) || this->indexAt(p_event->pos())==this->selectedIndexes().at(1) || this->indexAt(p_event->pos())==this->selectedIndexes().at(2))) { return; } // Emit a click signal emit(this->clicked(this->indexAt(p_event->pos()))); // Create context menu and add actions QMenu context_menu(this); context_menu.addMenu(this->p_menu_copy); context_menu.exec(p_event->globalPos()); } void RegistryKeyTable::SlotCopyKeyName() { QApplication::clipboard()-> setText(this->selectedIndexes().at(0).data().toString(), QClipboard::Clipboard); } void RegistryKeyTable::SlotCopyKeyValue() { QApplication::clipboard()-> setText(this->selectedIndexes().at(2).data().toString(), QClipboard::Clipboard); }