void FolderWizardTargetPage::slotDirCheckReply(const QString &url, QNetworkReply *reply) { qDebug() << "Got reply from owncloud dir check: " << url << " :" << reply->error(); _dirChecked = (reply->error() == QNetworkReply::NoError); if( _dirChecked ) { showWarn(); } else { showWarn( tr("The folder is not available on your ownCloud.<br/>Click to let mirall create it."), true ); } emit completeChanged(); }
bool FolderWizardTargetPage::isComplete() const { QString dir = _ui.OCFolderLineEdit->text(); if( dir.isEmpty() || dir == QLatin1String("/") ) { showWarn( tr("If you sync the root folder, you can <b>not</b> configure another sync directory."), false); return true; } else { if( _dirChecked ) { showWarn(); } return _dirChecked; } }
void FolderWizardTargetPage::slotCreateRemoteFolderFinished( QNetworkReply::NetworkError error ) { qDebug() << "** webdav mkdir request finished " << error; // the webDAV server seems to return a 202 even if mkdir was successful. if( error == QNetworkReply::NoError || error == QNetworkReply::ContentOperationNotPermittedError) { showWarn( tr("Folder was successfully created on %1.").arg( Theme::instance()->appNameGUI() ) ); slotRefreshFolders(); } else { showWarn( tr("Failed to create the folder on %1.<br/>Please check manually.").arg( Theme::instance()->appNameGUI() ) ); } }
void FolderWizardTargetPage::slotCreateRemoteFolderFinished( QNetworkReply::NetworkError error ) { qDebug() << "** webdav mkdir request finished " << error; _ui.OCFolderLineEdit->setEnabled( true ); // the webDAV server seems to return a 202 even if mkdir was successful. if( error == QNetworkReply::NoError || error == QNetworkReply::ContentOperationNotPermittedError) { showWarn( tr("Folder on ownCloud was successfully created."), false ); slotTimerFires(); } else { showWarn( tr("Failed to create the folder on ownCloud.<br/>Please check manually."), false ); } }
void FolderWizardTargetPage::initializePage() { showWarn(); /* check the owncloud configuration file and query the ownCloud */ ownCloudInfo *ocInfo = ownCloudInfo::instance(); if( ocInfo->isConfigured() ) { connect( ocInfo, SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)), SLOT(slotOwnCloudFound(QString,QString,QString,QString))); connect( ocInfo, SIGNAL(noOwncloudFound(QNetworkReply*)), SLOT(slotNoOwnCloudFound(QNetworkReply*))); connect( ocInfo, SIGNAL(ownCloudDirExists(QString,QNetworkReply*)), SLOT(slotDirCheckReply(QString,QNetworkReply*))); connect( ocInfo, SIGNAL(webdavColCreated(QNetworkReply::NetworkError)), SLOT(slotCreateRemoteFolderFinished( QNetworkReply::NetworkError ))); connect(_ui._buttCreateFolder, SIGNAL(clicked()), SLOT(slotCreateRemoteFolder())); ocInfo->checkInstallation(); _ui.OCFolderLineEdit->setEnabled( false ); QString dir = _ui.OCFolderLineEdit->text(); if( !dir.isEmpty() ) { slotFolderTextChanged( dir ); } } }
void FolderWizardTargetPage::slotNoOwnCloudFound( QNetworkReply* error ) { qDebug() << "No ownCloud configured: " << error->error(); // _ui.OCLabel->setText( tr("no configured %1 found!").arg(Theme::instance()->appNameGUI()) ); showWarn( tr("%1 could not be reached:<br/><tt>%2</tt>") .arg(Theme::instance()->appNameGUI()).arg(error->errorString())); _ui.OCFolderLineEdit->setEnabled( false ); }
void FolderWizardTargetPage::slotNoOwnCloudFound( QNetworkReply* error ) { qDebug() << "No ownCloud configured: " << error->error(); _ui.OCLabel->setText( tr("no configured ownCloud found!") ); showWarn( tr("Your ownCloud could not be reached:<br/><tt>%1</tt>").arg(error->errorString())); _ui.OCRadioBtn->setEnabled( false ); _ui.OCFolderLineEdit->setEnabled( false ); }
bool FolderWizardTargetPage::isComplete() const { if (_ui.localFolderRadioBtn->isChecked()) { return QFileInfo(_ui.localFolder2LineEdit->text()).isDir(); } else if (_ui.urlFolderRadioBtn->isChecked()) { QUrl url(_ui.urlFolderLineEdit->text()); return url.isValid() && (url.scheme() == QLatin1String("sftp") || url.scheme() == QLatin1String("smb")); } else if( _ui.OCRadioBtn->isChecked()) { /* owncloud selected */ QString dir = _ui.OCFolderLineEdit->text(); if( dir.isEmpty() ) { showWarn( tr("Better do not use the remote root directory.<br/>If you do, you can <b>not</b> mirror another local folder."), false); return true; } else { if( _dirChecked ) { showWarn(); } return _dirChecked; } } return false; }
void FolderWizardTargetPage::initializePage() { slotToggleItems(); showWarn(); /* check the owncloud configuration file and query the ownCloud */ ownCloudInfo *ocInfo = ownCloudInfo::instance(); if( ocInfo->isConfigured() ) { connect(ocInfo,SIGNAL(ownCloudInfoFound(QString,QString,QString,QString)),SLOT(slotOwnCloudFound(QString,QString,QString,QString))); connect(ocInfo,SIGNAL(noOwncloudFound(QNetworkReply*)),SLOT(slotNoOwnCloudFound(QNetworkReply*))); connect(_ui._buttCreateFolder, SIGNAL(clicked()), SLOT(slotCreateRemoteFolder())); ocInfo->checkInstallation(); } else { _ui.OCRadioBtn->setEnabled( false ); _ui.OCFolderLineEdit->setEnabled( false ); } QString dir = _ui.OCFolderLineEdit->text(); if( !dir.isEmpty() ) { slotFolderTextChanged( dir ); } }
void FolderWizardTargetPage::cleanupPage() { showWarn(); }
//----------------------------------------------------------------------------- // // Class MainWindow // //----------------------------------------------------------------------------- MainWindow::MainWindow(QWidget *wp) : QMainWindow(wp) { QAction *a; setWindowTitle(_("untitled - UDAV")); setAttribute(Qt::WA_DeleteOnClose); split = new QSplitter(this); ltab = new QTabWidget(split); ltab->setMovable(true); ltab->setTabPosition(QTabWidget::South); // ltab->setTabsClosable(true); rtab = new QTabWidget(split); rtab->setMovable(true); rtab->setTabPosition(QTabWidget::South); messWnd = new QDockWidget(_("Messages and warnings"),this); mess = new QTextEdit(this); messWnd->setWidget(mess); messWnd->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); addDockWidget(Qt::BottomDockWidgetArea, messWnd); messWnd->resize(size().width(), 0); new MessSyntax(mess); // connect(mess,SIGNAL(cursorPositionChanged()),this,SLOT(messClicked())); connect(mess,SIGNAL(selectionChanged()),this,SLOT(messClicked())); hideWnd = new QDockWidget(_("Hidden plots"),this); hidden = new TextEdit(this); hideWnd->setWidget(hidden); hideWnd->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); addDockWidget(Qt::BottomDockWidgetArea, hideWnd); hideWnd->resize(size().width(), 0); hidden->setReadOnly(true); connect(hidden,SIGNAL(selectionChanged()),this,SLOT(hiddenClicked())); // TODO // connect(hidden,SIGNAL(cursorPositionChanged()),this,SLOT(hiddenClicked())); calcWnd = new QDockWidget(_("Calculator"),this); aload = a = new QAction(QPixmap(":/png/document-open.png"), _("Open file"), this); connect(a, SIGNAL(triggered()), this, SLOT(choose())); a->setToolTip(_("Open and execute/show script or data from file (Ctrl+O).\nYou may switch off automatic exection in UDAV properties.")); a->setShortcut(Qt::CTRL+Qt::Key_O); asave = a = new QAction(QPixmap(":/png/document-save.png"), _("Save script"), this); connect(a, SIGNAL(triggered()), this, SLOT(save())); a->setToolTip(_("Save script to a file (Ctrl+S)")); a->setShortcut(Qt::CTRL+Qt::Key_S); acalc = a = new QAction(QPixmap(":/png/accessories-calculator.png"), _("Calculator"), this); a->setShortcut(Qt::Key_F4); a->setCheckable(true); connect(a, SIGNAL(toggled(bool)), calcWnd, SLOT(setVisible(bool))); connect(calcWnd, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool))); a->setToolTip(_("Show calculator which evaluate and help to type textual formulas.\nTextual formulas may contain data variables too.")); a->setChecked(false); calcWnd->setVisible(false); ainfo = a = new QAction(_("Show info"), this); a->setShortcut(Qt::Key_F2); a->setCheckable(true); connect(a, SIGNAL(toggled(bool)), messWnd, SLOT(setVisible(bool))); connect(messWnd, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool))); a->setChecked(false); messWnd->setVisible(false); ahide = a = new QAction(QPixmap(":/png/layer-visible-on.png"), _("Show hidden plots"), this); a->setShortcut(Qt::Key_F8); a->setCheckable(true); connect(a, SIGNAL(toggled(bool)), hideWnd, SLOT(setVisible(bool))); connect(hideWnd, SIGNAL(visibilityChanged(bool)), a, SLOT(setChecked(bool))); a->setChecked(false); hideWnd->setVisible(false); graph = new PlotPanel(this); rtab->addTab(graph,QPixmap(":/png/office-chart-line.png"),_("Canvas")); // connect(info,SIGNAL(addPanel(QWidget*)),this,SLOT(addPanel(QWidget*))); info = createMemPanel(this); rtab->addTab(info,QPixmap(":/png/system-file-manager.png"),_("Info")); hlp = createHlpPanel(this); rtab->addTab(hlp,QPixmap(":/png/help-contents.png"),_("Help")); edit = new TextPanel(this); edit->graph = graph; graph->textMGL = edit->edit; connect(graph->mgl,SIGNAL(showWarn(QString)),mess,SLOT(setText(QString))); connect(graph->mgl,SIGNAL(showWarn(QString)),edit->edit,SLOT(setErrMessage(QString))); connect(graph,SIGNAL(clearWarn()),mess,SLOT(clear())); ltab->addTab(edit,QPixmap(":/png/text-plain.png"),_("Script")); calcWnd->setWidget(createCalcDlg(this, edit->edit)); calcWnd->setAllowedAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea); addDockWidget(Qt::BottomDockWidgetArea, calcWnd); calcWnd->resize(size().width(), 200); makeMenu(); setCentralWidget(split); setWindowIcon(QIcon(":/udav.png")); readSettings(); if(!propDlg) propDlg = new PropDialog; connect(graph, SIGNAL(save()), this, SLOT(save())); connect(graph, SIGNAL(setStatus(const QString &)), this, SLOT(setStatus(const QString &))); connect(graph, SIGNAL(animPutText(const QString &)), edit, SLOT(animPutText(const QString &))); connect(graph,SIGNAL(giveFocus()),edit->edit,SLOT(setFocus())); connect(graph->mgl, SIGNAL(objChanged(int)), edit, SLOT(setCursorPosition(int))); // connect(graph->mgl, SIGNAL(posChanged(QString)), statusBar(), SLOT(showMessage(QString))); connect(graph->mgl, SIGNAL(refreshData()), this, SLOT(refresh())); connect(graph->mgl, SIGNAL(refreshData()), edit, SLOT(refreshData())); connect(graph->mgl,SIGNAL(doubleClick(int)),edit,SLOT(newCmd(int))); connect(edit->edit,SIGNAL(textChanged()),this,SLOT(updateHidden())); connect(mess, SIGNAL(textChanged()), this, SLOT(warnChanged())); connect(propDlg, SIGNAL(sizeChanged(int,int)), graph->mgl, SLOT(imgSize(int,int))); connect(edit->edit,SIGNAL(textChanged()), this, SLOT(setAsterix())); connect(edit->edit, SIGNAL(cursorPositionChanged()), this, SLOT(editPosChanged())); connect(edit,SIGNAL(setCurrentFile(QString)),this,SLOT(setCurrentFile(QString))); connect(edit,SIGNAL(setStatus(QString)),this,SLOT(setStatus(QString))); setStatus(_("Ready")); num_wnd++; edit->setAcceptDrops(false); // for disabling default action by 'edit' setAcceptDrops(true); }