Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
ivan.ilyin 13 years ago
commit f6c6c2b451
  1. 7
      src/board/UBLibraryController.cpp
  2. 3
      src/board/UBLibraryController.h
  3. 22
      src/core/UBApplicationController.cpp
  4. 3
      src/core/UBApplicationController.h
  5. 1
      src/network/UBNetworkAccessManager.cpp

@ -72,7 +72,9 @@ UBLibraryController::UBLibraryController(QWidget *pParentWidget) :
bool UBLibraryController::canItemsOnElementBeDeleted(UBLibElement *pElement) bool UBLibraryController::canItemsOnElementBeDeleted(UBLibElement *pElement)
{ {
return !pElement->path().toLocalFile().startsWith(UBSettings::settings()->uniboardShapeLibraryDirectory()); return !pElement->path().toLocalFile().startsWith(UBSettings::settings()->uniboardShapeLibraryDirectory()) &&
!pElement->path().toLocalFile().startsWith(UBSettings::settings()->sankoreDistributedInteractiveDirectory()) &&
pElement->isDeletable();
} }
void UBLibraryController::createInternalWidgetItems() void UBLibraryController::createInternalWidgetItems()
@ -696,6 +698,7 @@ UBLibElement::UBLibElement() {
mType = eUBLibElementType_Category; mType = eUBLibElementType_Category;
mName = QObject::tr("/Home", "Category list label on navigation tool bar"); mName = QObject::tr("/Home", "Category list label on navigation tool bar");
mbMoveable = false; mbMoveable = false;
mbDeletable = true;
} }
UBLibElement::UBLibElement(UBLibElement* element) UBLibElement::UBLibElement(UBLibElement* element)
@ -707,6 +710,7 @@ UBLibElement::UBLibElement(UBLibElement* element)
mName = element->name(); mName = element->name();
mExtension = element->extension(); mExtension = element->extension();
mbMoveable = element->isMoveable(); mbMoveable = element->isMoveable();
mbDeletable = element->isDeletable();
} }
@ -717,6 +721,7 @@ UBLibElement::UBLibElement(eUBLibElementType type, const QUrl &path, const QStri
mName = name; mName = name;
mInfo = ""; mInfo = "";
mbMoveable = true; mbMoveable = true;
mbDeletable = true;
if (type == eUBLibElementType_Folder) if (type == eUBLibElementType_Folder)
mThumbnail = QImage(":images/libpalette/folder.svg"); mThumbnail = QImage(":images/libpalette/folder.svg");

@ -61,6 +61,8 @@ public:
void setExtension(QString &extension){ mExtension = extension;} void setExtension(QString &extension){ mExtension = extension;}
bool isMoveable(){return mbMoveable;} bool isMoveable(){return mbMoveable;}
void setMoveable(bool bState){mbMoveable = bState;} void setMoveable(bool bState){mbMoveable = bState;}
bool isDeletable() const {return mbDeletable;}
void setDeletable(bool mState) {mbDeletable = mState;}
private: private:
eUBLibElementType mType; eUBLibElementType mType;
@ -70,6 +72,7 @@ private:
QString mName; QString mName;
QString mExtension; QString mExtension;
bool mbMoveable; bool mbMoveable;
bool mbDeletable;
}; };
class UBChainedLibElement class UBChainedLibElement

@ -49,6 +49,8 @@
#include "podcast/UBPodcastController.h" #include "podcast/UBPodcastController.h"
#include "network/UBNetworkAccessManager.h"
#include "ui_mainWindow.h" #include "ui_mainWindow.h"
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
@ -70,6 +72,7 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView, UBBo
, mAutomaticCheckForUpdates(false) , mAutomaticCheckForUpdates(false)
, mCheckingForUpdates(false) , mCheckingForUpdates(false)
, mIsShowingDesktop(false) , mIsShowingDesktop(false)
, mHttp(0)
{ {
mDisplayManager = new UBDisplayManager(this); mDisplayManager = new UBDisplayManager(this);
@ -121,6 +124,7 @@ UBApplicationController::~UBApplicationController()
delete mBlackScene; delete mBlackScene;
delete mMirror; delete mMirror;
if (mFtp) delete mFtp; if (mFtp) delete mFtp;
if (mHttp) delete mHttp;
} }
@ -499,18 +503,30 @@ void UBApplicationController::showSankoreEditor()
emit mainModeChanged(mMainMode); emit mainModeChanged(mMainMode);
} }
void UBApplicationController::runCheckUpdate(int id, bool error)
void UBApplicationController::checkUpdate()
{ {
if(!error){
if(mFtp!=NULL) if(mFtp!=NULL)
delete mFtp; delete mFtp;
mFtp = new QFtp(this); mFtp = new QFtp(this);
connect(mFtp, SIGNAL(commandFinished(int,bool)), this, SLOT(ftpCommandFinished(int,bool))); connect(mFtp, SIGNAL(commandFinished(int,bool)), this, SLOT(ftpCommandFinished(int,bool)));
mFtp->connectToHost("91.121.248.138",21); mFtp->connectToHost("91.121.248.138",21);
mFtp->login("anonymous", "anonymous"); mFtp->login("anonymous", "anonymous");
mFtp->get("update.json",0); mFtp->get("update.json",0);
} }
}
void UBApplicationController::checkUpdate()
{
//TODO change this when upgrade the qt version
// networkAccessible : NetworkAccessibility not yet available
if(mHttp)
delete mHttp;
QUrl url("http://www.google.com");
mHttp = new QHttp(url.host());
connect(mHttp, SIGNAL(requestFinished(int,bool)), this, SLOT(runCheckUpdate(int,bool)));
mHttp->get(url.path());
}
void UBApplicationController::ftpCommandFinished(int id, bool error) void UBApplicationController::ftpCommandFinished(int id, bool error)
{ {

@ -30,6 +30,7 @@ class UBVersion;
class UBSoftwareUpdate; class UBSoftwareUpdate;
class QNetworkAccessManager; class QNetworkAccessManager;
class QNetworkReply; class QNetworkReply;
class QHttp;
class UBApplicationController : public QObject class UBApplicationController : public QObject
@ -135,6 +136,7 @@ class UBApplicationController : public QObject
private slots: private slots:
void ftpCommandFinished(int id, bool error); void ftpCommandFinished(int id, bool error);
void runCheckUpdate(int id, bool error);
protected: protected:
@ -171,6 +173,7 @@ class UBApplicationController : public QObject
QNetworkAccessManager *networkAccessManager; QNetworkAccessManager *networkAccessManager;
void downloadJsonFinished(QString updateString); void downloadJsonFinished(QString updateString);
QHttp* mHttp;
}; };
#endif /* UBAPPLICATIONCONTROLLER_H_ */ #endif /* UBAPPLICATIONCONTROLLER_H_ */

@ -173,4 +173,3 @@ void UBNetworkAccessManager::sslErrors(QNetworkReply *reply, const QList<QSslErr
} }
} }
} }

Loading…
Cancel
Save