Fixed SANKORE-536

Show desktop: "Add folder" make sankore freezes after virtual keyboard was opened
preferencesAboutTextFull
Aleksei Kanash 12 years ago
parent d82fdd7d0a
commit afd70ddc62
  1. 5
      src/board/UBFeaturesController.cpp
  2. 34
      src/gui/UBFeaturesWidget.cpp
  3. 4
      src/gui/UBFeaturesWidget.h
  4. 16
      src/gui/UBLibraryWidget.cpp
  5. 1
      src/gui/UBLibraryWidget.h

@ -424,6 +424,11 @@ void UBFeaturesController::addNewFolder(const QString &name)
{ {
QString path = currentElement.getFullPath().toLocalFile() + "/" + name; QString path = currentElement.getFullPath().toLocalFile() + "/" + name;
if ("/root" == currentElement.getFullVirtualPath())
{
return;
}
if(!QFileInfo(path).exists()) { if(!QFileInfo(path).exists()) {
QDir().mkpath(path); QDir().mkpath(path);
} }

@ -3,7 +3,6 @@
#include "UBFeaturesWidget.h" #include "UBFeaturesWidget.h"
#include "domain/UBAbstractWidget.h" #include "domain/UBAbstractWidget.h"
#include "gui/UBThumbnailWidget.h" #include "gui/UBThumbnailWidget.h"
#include "gui/UBLibraryWidget.h"
#include "frameworks/UBFileSystemUtils.h" #include "frameworks/UBFileSystemUtils.h"
#include "core/UBApplication.h" #include "core/UBApplication.h"
#include "core/UBDownloadManager.h" #include "core/UBDownloadManager.h"
@ -18,7 +17,10 @@ const int FeatureListBorderOffset = 10;
const char featureTypeSplitter = ':'; const char featureTypeSplitter = ':';
static const QString mimeSankoreFeatureTypes = "Sankore/featureTypes"; static const QString mimeSankoreFeatureTypes = "Sankore/featureTypes";
UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name):UBDockPaletteWidget(parent), imageGatherer(NULL) UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name)
: UBDockPaletteWidget(parent)
, imageGatherer(NULL)
, mkFolderDlg(NULL)
{ {
setObjectName(name); setObjectName(name);
@ -162,10 +164,22 @@ void UBFeaturesWidget::currentSelected(const QModelIndex &current)
void UBFeaturesWidget::createNewFolder() void UBFeaturesWidget::createNewFolder()
{ {
UBNewFolderDlg dlg; if (!mkFolderDlg)
if(QDialog::Accepted == dlg.exec()) { {
controller->addNewFolder(dlg.folderName()); mkFolderDlg = new UBNewFolderDlg(this);
connect (mkFolderDlg, SIGNAL(accepted()), this, SLOT(addFolder()));
} }
mkFolderDlg->setWindowFlags(Qt::WindowStaysOnTopHint);
mkFolderDlg->resize(this->size().width()-20 ,80);
mkFolderDlg->move(5,this->size().height()-200);
mkFolderDlg->show();
}
void UBFeaturesWidget::addFolder()
{
if (mkFolderDlg)
controller->addNewFolder(mkFolderDlg->folderName());
} }
void UBFeaturesWidget::deleteElements( const UBFeaturesMimeData * mimeData ) void UBFeaturesWidget::deleteElements( const UBFeaturesMimeData * mimeData )
@ -337,6 +351,16 @@ void UBFeaturesWidget::removeElementsFromFavorite()
controller->refreshModels(); controller->refreshModels();
} }
void UBFeaturesWidget::resizeEvent(QResizeEvent *event)
{
UBDockPaletteWidget::resizeEvent(event);
if (mkFolderDlg)
{
mkFolderDlg->resize(this->size().width()-20 ,80);
mkFolderDlg->move(5,this->size().height()-200);
}
}
void UBFeaturesWidget::switchToListView() void UBFeaturesWidget::switchToListView()
{ {
stackedWidget->setCurrentIndex(ID_LISTVIEW); stackedWidget->setCurrentIndex(ID_LISTVIEW);

@ -21,6 +21,7 @@
#include "api/UBWidgetUniboardAPI.h" #include "api/UBWidgetUniboardAPI.h"
#include "UBFeaturesActionBar.h" #include "UBFeaturesActionBar.h"
#include "UBRubberBand.h" #include "UBRubberBand.h"
#include "gui/UBLibraryWidget.h"
#define THUMBNAIL_WIDTH 400 #define THUMBNAIL_WIDTH 400
#define ID_LISTVIEW 0 #define ID_LISTVIEW 0
@ -71,6 +72,7 @@ private slots:
void currentSelected( const QModelIndex & ); void currentSelected( const QModelIndex & );
void searchStarted( const QString & ); void searchStarted( const QString & );
void createNewFolder(); void createNewFolder();
void addFolder();
void deleteElements( const UBFeaturesMimeData * ); void deleteElements( const UBFeaturesMimeData * );
void addToFavorite( const UBFeaturesMimeData *); void addToFavorite( const UBFeaturesMimeData *);
void removeFromFavorite( const UBFeaturesMimeData * ); void removeFromFavorite( const UBFeaturesMimeData * );
@ -82,6 +84,7 @@ private slots:
void rescanModel(); void rescanModel();
private: private:
void resizeEvent(QResizeEvent *event);
void switchToListView(); void switchToListView();
void switchToProperties(); void switchToProperties();
void switchToWebView(); void switchToWebView();
@ -97,6 +100,7 @@ private:
QStackedWidget *stackedWidget; QStackedWidget *stackedWidget;
int currentStackedWidget; int currentStackedWidget;
UBDownloadHttpFile* imageGatherer; UBDownloadHttpFile* imageGatherer;
UBNewFolderDlg *mkFolderDlg;
}; };

@ -547,7 +547,6 @@ UBNewFolderDlg::UBNewFolderDlg(QWidget *parent, const char *name):QDialog(parent
, mpAddButton(NULL) , mpAddButton(NULL)
, mpCancelButton(NULL) , mpCancelButton(NULL)
, mpLayout(NULL) , mpLayout(NULL)
, mpHLayout(NULL)
{ {
setObjectName(name); setObjectName(name);
setWindowTitle(tr("Add new folder")); setWindowTitle(tr("Add new folder"));
@ -562,15 +561,14 @@ UBNewFolderDlg::UBNewFolderDlg(QWidget *parent, const char *name):QDialog(parent
mpButtons = new QDialogButtonBox(Qt::Horizontal, this); mpButtons = new QDialogButtonBox(Qt::Horizontal, this);
mpLayout = new QVBoxLayout(this); mpLayout = new QVBoxLayout(this);
mpHLayout = new QHBoxLayout(0);
setLayout(mpLayout); setLayout(mpLayout);
mpLayout->addLayout(mpHLayout, 0);
mpHLayout->addWidget(mpLabel, 0); mpLayout->addWidget(mpLabel, 1);
mpHLayout->addWidget(mpLineEdit, 1); mpLayout->addWidget(mpLineEdit);
mpButtons->addButton(mpAddButton,QDialogButtonBox::ActionRole); mpButtons->addButton(mpAddButton,QDialogButtonBox::ActionRole);
mpButtons->addButton(mpCancelButton,QDialogButtonBox::ActionRole); mpButtons->addButton(mpCancelButton,QDialogButtonBox::ActionRole);
mpLayout->addWidget(mpButtons); mpLayout->addWidget(mpButtons, 1,Qt::AlignJustify);
connect(mpAddButton, SIGNAL(clicked()), this, SLOT(accept())); connect(mpAddButton, SIGNAL(clicked()), this, SLOT(accept()));
connect(mpCancelButton, SIGNAL(clicked()), this, SLOT(reject())); connect(mpCancelButton, SIGNAL(clicked()), this, SLOT(reject()));
@ -612,11 +610,7 @@ UBNewFolderDlg::~UBNewFolderDlg()
delete mpLabel; delete mpLabel;
mpLabel = NULL; mpLabel = NULL;
} }
if(NULL != mpHLayout)
{
delete mpHLayout;
mpHLayout = NULL;
}
if(NULL != mpLayout) if(NULL != mpLayout)
{ {
delete mpLayout; delete mpLayout;

@ -119,7 +119,6 @@ private:
QPushButton* mpAddButton; QPushButton* mpAddButton;
QPushButton* mpCancelButton; QPushButton* mpCancelButton;
QVBoxLayout* mpLayout; QVBoxLayout* mpLayout;
QHBoxLayout* mpHLayout;
}; };
#endif // UBLIBRARYWIDGET_H #endif // UBLIBRARYWIDGET_H

Loading…
Cancel
Save