Beispiel #1
0
void Trashdialog::init()
{
    QVBoxLayout *trash_layout = new QVBoxLayout();
    setLayout(trash_layout);
    QLabel *name = new QLabel(tr("TRASH"), this);
    name->setFrameStyle(QFrame::StyledPanel | QFrame::Raised);
    line_path = new QLineEdit(this); // show trash path
    line_path->setReadOnly(true);
    fs_model = new QFileSystemModel(this);
    prov = new Fileicon(); // get the files icon
    fs_model->setIconProvider(prov);
    fs_model->setFilter(fs_model->filter() | QDir::Hidden); // add hidden files to filter
    tree_view = new QTreeView(this);
    tree_view->setModel(fs_model);
    tree_view->setSortingEnabled(true);
    tree_view->setAlternatingRowColors(true);
    tree_view->setFocusPolicy(Qt::ClickFocus);
    tree_view->header()->setSortIndicator(0, Qt::AscendingOrder);
    tree_view->setSelectionMode(QAbstractItemView::ExtendedSelection);
    tree_view->setSelectionBehavior(QAbstractItemView::SelectItems);
    tree_view->setEditTriggers(QAbstractItemView::NoEditTriggers);
    trash_path = QDir::homePath() + "/.local/share"; // search in default path directory
    line_path->setText(trash_path + "/Trash/files");
    fs_model->setRootPath(trash_path + "/Trash/files");
    tree_view->setRootIndex(fs_model->index(trash_path + "/Trash/files"));
    QHBoxLayout *button_layout = new QHBoxLayout();
    QPushButton* delete_but = new QPushButton(QIcon(remove_button_pix), tr("Delete"), this);
    QPushButton* restore_but = new QPushButton(QIcon(restore_button_pix), tr("Restore"), this);
    QPushButton* close_but = new QPushButton(QIcon(close_button_pix), tr("Close"), this);
    button_layout->addWidget(delete_but);
    button_layout->addWidget(restore_but);
    button_layout->addWidget(close_but);
    connect(delete_but, SIGNAL(pressed()), this, SLOT(delete_pressed()));
    connect(restore_but, SIGNAL(pressed()), this, SLOT(restore_pressed()));
    connect(close_but, SIGNAL(pressed()), this, SLOT(close_pressed()));
    trash_layout->addWidget(name);
    trash_layout->addWidget(line_path);
    trash_layout->addWidget(tree_view);
    trash_layout->addLayout(button_layout);
}
Beispiel #2
0
		UndoManagerDialog::UndoManagerDialog( QWidget* parent, const char* name, Qt::WindowFlags fl )
			: QDialog(parent, fl),
			  Ui_UndoManagerDialogData(),
				ModularWidget(name),
				action_(0),
				first_run(true)
		{
			#ifdef BALL_VIEW_DEBUG
				Log.error() << "new undoManagerDialog " << this << std::endl;
			#endif

			setupUi(this);
			setObjectName(name);

			// register the widget with the MainControl
			ModularWidget::registerWidget(this);
			hide();

			// signals and slots connections
			connect( close_button, SIGNAL( pressed() ), this, SLOT( close_pressed() ) );
			connect( add_snapshot_button, SIGNAL( pressed() ), this, SLOT( takeSnapshot_pressed() ) );
			connect( reset_to_button, SIGNAL( pressed() ), this, SLOT( resetTo_pressed() ) );
			close_button->setEnabled(true);
		}