Exemple #1
0
CaseInModel::CaseInModel(QObject *parent) :
	AbstractScrollableModel(parent)
	, m_lastError("")
{
	m_cache_size = 10;
	m_cache.resize( m_cache_size );
	updatePageCount();
}
Exemple #2
0
void Fetcher::search()
{
    updatePageCount();

    if ( (ui->leQuery->text().isEmpty()) && (ui->cbSite->itemText(ui->cbSite->currentIndex()).isEmpty()) )
        showErrorMessage("<h3>No search terms entered.</h3><p>Please enter some search terms, or specify a site to search in the 'More Options' section.</p>",this);
    else if (queryResultsCount.find(ui->leQuery->text()).value() > 7)
        showErrorMessage("The maximum number of results for this search term has been reached. Try a different search term.",this);
    else
    {
        QUrl tmpUrl = composeUrl();
        downloadUrl(tmpUrl);
        (*queryResultsCount.find(ui->leQuery->text()))++;
    }
}
Exemple #3
0
bool CaseInModel::insertCase(QString datawej, QString he, QString jednostka, QString rsd, QString opis, QString przydzial, QString rodzaj, QString datazab, QString uwagi)
{
	QSqlQuery query( SqlConnectionController::qSqlDb() );

	if (he != "")
	{
		if (isHeUnique(he))
		{
			if (jednostka != "0")
			{
				if (rsd != "")
				{
					if (przydzial != "0")
					{
						if ((QStringList() << "k" << "w" << "u" <<"uk" << "r").contains(rodzaj) )
						{
							query.exec("INSERT INTO sprawy_wejscie VALUES('"+datawej+"','"+he+"','"+jednostka+"','"+rsd+"','"+opis+"','"+przydzial+"','"+rodzaj+"','"+datazab+"','"+uwagi+"')");
							updatePageCount();
							lastPage(true);
							emit recordInserted();
							return true;
						}
						else
							m_lastError = "Wrong rodzaj";
					}
					else
						m_lastError = "Przydzial must be selected";
				}
				else
					m_lastError = "Rsd nr cannot be empty";
			}
			else
				m_lastError = "Jednostka must be selected";
		}
		else
			m_lastError = "Nr He must be unique";
	}
	else
		m_lastError = "Nr he cannot be empty";


	return false;
}
Exemple #4
0
void CaseInModel::removeRow(int i)
{
	QString rowid = m_cache[0][i].toString();

	QSqlQuery query( SqlConnectionController::qSqlDb() );

	query.exec("DELETE FROM sprawy_wejscie WHERE rowid = " + rowid );

	rowsDeleteBeganNotify(i,i);

	for ( int j = 0; j < m_cache_size; ++j )
	{
		m_cache[j].remove(i);
	}

	rowsDeleteFinishedNotify();

	updatePageCount();
	load_cache();
}
Exemple #5
0
bool KoPADocument::loadOdf(KOdfStoreReader &odfStore)
{
    QPointer<KoUpdater> updater;
    if (progressUpdater()) {
        updater = progressUpdater()->startSubtask(1, "KoPADocument::loadOdf");
        updater->setProgress(0);
    }
    KOdfLoadingContext loadingContext(odfStore.styles(), odfStore.store(), componentData());
    KoPALoadingContext paContext(loadingContext, resourceManager());

    KXmlElement content = odfStore.contentDoc().documentElement();
    KXmlElement realBody (KoXml::namedItemNS(content, KOdfXmlNS::office, "body"));

    if (realBody.isNull()) {
        kError(30010) << "No body tag found!" << endl;
        return false;
    }

    KXmlElement body = KoXml::namedItemNS(realBody, KOdfXmlNS::office, odfTagName(false));

    if (body.isNull()) {
        kError(30010) << "No office:" << odfTagName(false) << " tag found!" << endl;
        return false;
    }

    // Load text styles before the corresponding text shapes try to use them!
    KTextSharedLoadingData * sharedData = new KTextSharedLoadingData();
    paContext.addSharedData(KODFTEXT_SHARED_LOADING_ID, sharedData);
    KStyleManager *styleManager = resourceManager()->resource(KOdfText::StyleManager).value<KStyleManager*>();

    sharedData->loadOdfStyles(paContext, styleManager);

    d->masterPages = loadOdfMasterPages(odfStore.styles().masterPages(), paContext);
    if (!loadOdfProlog(body, paContext)) {
        return false;
    }
    d->pages = loadOdfPages(body, paContext);

    // create pages if there are none
    if (d->masterPages.empty()) {
        d->masterPages.append(newMasterPage());
    }
    if (d->pages.empty()) {
        d->pages.append(newPage(static_cast<KoPAMasterPage*>(d->masterPages.first())));
    }

    if (!loadOdfEpilogue(body, paContext)) {
        return false;
    }

    loadOdfDocumentStyles(paContext);

    if (d->pages.size() > 1) {
        setActionEnabled(KoPAView::ActionDeletePage, false);
    }

    updatePageCount();

    if (updater) updater->setProgress(100);
    return true;
}