Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
b484dae4
Commit
b484dae4
authored
May 10, 2012
by
Anna Udovichenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented removing selected items
parent
59221084
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
2 deletions
+57
-2
UBFeaturesActionBar.cpp
src/gui/UBFeaturesActionBar.cpp
+10
-2
UBFeaturesActionBar.h
src/gui/UBFeaturesActionBar.h
+2
-0
UBFeaturesWidget.cpp
src/gui/UBFeaturesWidget.cpp
+43
-0
UBFeaturesWidget.h
src/gui/UBFeaturesWidget.h
+2
-0
No files found.
src/gui/UBFeaturesActionBar.cpp
View file @
b484dae4
...
...
@@ -66,8 +66,8 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid
mButtonGroup
->
addButton
(
mpRemoveFavoriteBtn
);
mButtonGroup
->
addButton
(
mpNewFolderBtn
);
// Connect signals & slots
connect
(
mpFavoriteAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
onActionFavorite
()));
/*
connect(mpSocialAction,SIGNAL(triggered()), this, SLOT(onActionSocial()));
/*
connect(mpFavoriteAction,SIGNAL(triggered()), this, SLOT(onActionFavorite()));
connect(mpSocialAction,SIGNAL(triggered()), this, SLOT(onActionSocial()));
connect(mpSearchAction,SIGNAL(triggered()), this, SLOT(onActionSearch()));
connect(mpDeleteAction,SIGNAL(triggered()), this, SLOT(onActionTrash()));
connect(mpCloseAction, SIGNAL(triggered()), this, SLOT(onActionClose()));
...
...
@@ -78,6 +78,7 @@ UBFeaturesActionBar::UBFeaturesActionBar( UBFeaturesController *controller, QWid
connect
(
mSearchBar
,
SIGNAL
(
textChanged
(
QString
)),
this
,
SLOT
(
onSearchTextChanged
(
QString
)));
connect
(
mpNewFolderAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
onActionNewFolder
()));
connect
(
mpRemoveFavorite
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
onActionRemoveFavorite
()));
connect
(
mpDeleteAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
onActionTrash
()));
// Build the default toolbar
mLayout
->
addWidget
(
mpFavoriteBtn
);
...
...
@@ -149,6 +150,8 @@ void UBFeaturesActionBar::setButtons()
mpFavoriteBtn
->
hide
();
mpSocialBtn
->
hide
();
mSearchBar
->
show
();
mpDeleteBtn
->
show
();
mpDeleteBtn
->
setEnabled
(
true
);
//mpSearchBtn->show();
//mpDeleteBtn->hide();
mpCloseBtn
->
hide
();
...
...
@@ -181,6 +184,11 @@ void UBFeaturesActionBar::onActionRemoveFavorite()
emit
removeElementsFromFavorite
();
}
void
UBFeaturesActionBar
::
onActionTrash
()
{
emit
deleteSelectedElements
();
}
/*
void UBFeaturesActionBar::dragMoveEvent(QDragMoveEvent *event)
{
...
...
src/gui/UBFeaturesActionBar.h
View file @
b484dae4
...
...
@@ -32,11 +32,13 @@ signals:
void
removeFromFavorite
(
const
QMimeData
&
data
);
void
addElementsToFavorite
();
void
removeElementsFromFavorite
();
void
deleteSelectedElements
();
private
slots
:
void
onSearchTextChanged
(
QString
txt
);
void
onActionNewFolder
();
void
onActionFavorite
();
void
onActionRemoveFavorite
();
void
onActionTrash
();
protected
:
//void dragMoveEvent(QDragMoveEvent *event);
void
dragEnterEvent
(
QDragEnterEvent
*
event
);
...
...
src/gui/UBFeaturesWidget.cpp
View file @
b484dae4
...
...
@@ -123,6 +123,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPale
connect
(
mActionBar
,
SIGNAL
(
removeFromFavorite
(
const
QMimeData
&
)
),
this
,
SLOT
(
removeFromFavorite
(
const
QMimeData
&
)
)
);
connect
(
mActionBar
,
SIGNAL
(
addElementsToFavorite
()
),
this
,
SLOT
(
addElementsToFavorite
()
)
);
connect
(
mActionBar
,
SIGNAL
(
removeElementsFromFavorite
()
),
this
,
SLOT
(
removeElementsFromFavorite
()
)
);
connect
(
mActionBar
,
SIGNAL
(
deleteSelectedElements
()
),
this
,
SLOT
(
deleteSelectedElements
()
)
);
connect
(
pathListView
,
SIGNAL
(
clicked
(
const
QModelIndex
&
)
),
this
,
SLOT
(
currentPathChanged
(
const
QModelIndex
&
)
)
);
connect
(
thumbSlider
,
SIGNAL
(
sliderMoved
(
int
)
),
this
,
SLOT
(
thumbnailSizeChanged
(
int
)
)
);
...
...
@@ -278,6 +279,36 @@ void UBFeaturesWidget::deleteElements( const QMimeData & mimeData )
model
->
invalidate
();
}
void
UBFeaturesWidget
::
deleteSelectedElements
()
{
QModelIndexList
selected
=
featuresListView
->
selectionModel
()
->
selectedIndexes
();
QList
<
QUrl
>
urls
;
foreach
(
QModelIndex
sel
,
selected
)
{
UBFeature
feature
=
sel
.
data
(
Qt
::
UserRole
+
1
).
value
<
UBFeature
>
();
urls
.
append
(
feature
.
getFullPath
()
);
}
foreach
(
QUrl
url
,
urls
)
{
if
(
controller
->
isTrash
(
url
)
)
{
controller
->
deleteItem
(
url
);
}
else
{
UBFeature
elem
=
controller
->
moveItemToFolder
(
url
,
controller
->
getTrashElement
()
);
controller
->
removeFromFavorite
(
url
);
featuresModel
->
addItem
(
elem
);
featuresModel
->
deleteFavoriteItem
(
url
.
toString
()
);
}
featuresModel
->
deleteItem
(
url
.
toString
()
);
}
QSortFilterProxyModel
*
model
=
dynamic_cast
<
QSortFilterProxyModel
*>
(
featuresListView
->
model
()
);
model
->
invalidate
();
}
void
UBFeaturesWidget
::
addToFavorite
(
const
QMimeData
&
mimeData
)
{
if
(
!
mimeData
.
hasUrls
()
)
...
...
@@ -902,6 +933,18 @@ void UBFeaturesModel::deleteFavoriteItem( const QString &path )
}
}
void
UBFeaturesModel
::
deleteItem
(
const
QString
&
path
)
{
for
(
int
i
=
0
;
i
<
featuresList
->
size
();
++
i
)
{
if
(
!
QString
::
compare
(
featuresList
->
at
(
i
).
getFullPath
().
toString
(),
path
,
Qt
::
CaseInsensitive
)
)
{
removeRow
(
i
,
QModelIndex
()
);
return
;
}
}
}
bool
UBFeaturesModel
::
removeRows
(
int
row
,
int
count
,
const
QModelIndex
&
parent
)
{
if
(
row
<
0
)
...
...
src/gui/UBFeaturesWidget.h
View file @
b484dae4
...
...
@@ -103,6 +103,7 @@ private slots:
void
onAddDownloadedFileToLibrary
(
bool
,
QUrl
,
QString
,
QByteArray
);
void
addElementsToFavorite
();
void
removeElementsFromFavorite
();
void
deleteSelectedElements
();
protected
:
bool
eventFilter
(
QObject
*
target
,
QEvent
*
event
);
};
...
...
@@ -200,6 +201,7 @@ public:
void
addItem
(
const
UBFeature
&
item
);
void
deleteFavoriteItem
(
const
QString
&
path
);
void
deleteItem
(
const
QString
&
path
);
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
;
QMimeData
*
mimeData
(
const
QModelIndexList
&
indexes
)
const
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment