Exemple #1
0
void Archive::loadExtractedBaskets(const QString &extractionFolder, QDomNode &basketNode, QMap<QString, QString> &folderMap, Basket *parent)
{
	bool basketSetAsCurrent = (parent != 0);
	QDomNode n = basketNode;
	while ( ! n.isNull() ) {
		QDomElement element = n.toElement();
		if ( (!element.isNull()) && element.tagName() == "basket" ) {
			QString folderName = element.attribute("folderName");
			if (!folderName.isEmpty()) {
				// Move the basket folder to its destination, while renaming it uniquely:
				QString newFolderName = folderMap[folderName];
				FormatImporter copier;
				// The folder has been "reserved" by creating it. Avoid asking the user to override:
				QDir dir;
				dir.rmdir(Global::basketsFolder() + newFolderName);
				copier.moveFolder(extractionFolder + "baskets/" + folderName, Global::basketsFolder() + newFolderName);
				// Append and load the basket in the tree:
				Basket *basket = Global::bnpView->loadBasket(newFolderName);
				BasketListViewItem *basketItem = Global::bnpView->appendBasket(basket, (basket && parent ? Global::bnpView->listViewItemForBasket(parent) : 0));
				basketItem->setExpanded(!XMLWork::trueOrFalse(element.attribute("folded", "false"), false));
				QDomElement properties = XMLWork::getElement(element, "properties");
				importBasketIcon(properties, extractionFolder); // Rename the icon fileName if necessary
				basket->loadProperties(properties);
				// Open the first basket of the archive:
				if (!basketSetAsCurrent) {
					Global::bnpView->setCurrentBasket(basket);
					basketSetAsCurrent = true;
				}
				QDomNode node = element.firstChild();
				loadExtractedBaskets(extractionFolder, node, folderMap, basket);
			}
		}
		n = n.nextSibling();
	}
}
Exemple #2
0
TEST(CxxCaseQuote, MockBulk)
{
  using namespace case_quote;

  // Bulk_quote sales which has discount: minimum 5 and 25% discount
  // 35*6*(1-.25) = 157.5
  shared_ptr<MockBulk> q1(new MockBulk("912", 35, 5, .25));
  shared_ptr<MockBulk> q2(new MockBulk("912", 35, 5, .25));
  shared_ptr<MockBulk> q3(new MockBulk("912", 35, 5, .25));
  shared_ptr<MockBulk> q4(new MockBulk("912", 35, 5, .25));
  shared_ptr<MockBulk> q5(new MockBulk("912", 35, 5, .25));

  EXPECT_CALL(*q1, net_price(_))
    .WillOnce(Return(157.5));

  Basket sale;

  sale.add_item(q1);
  sale.add_item(q2);
  sale.add_item(q3);
  sale.add_item(q4);
  sale.add_item(q5);

  EXPECT_EQ(sale.total_receipt(cout), 157.5);
}
Exemple #3
0
int main()
{
    Basket basket;
    basket.add_item(Quote("0-201-82470-1", 50));
    for (int i = 0; i < 15; ++i)
        basket.add_item(Bulk_quote("0-201-54848-8", 50, 10, .25));
    basket.total_receipt(cout);
    return 0;
}
Exemple #4
0
void SystemTray::updateToolTipDelayed()
{
	Basket *basket = Global::bnpView->currentBasket();

	QString tip = "<p><nobr>" + ( basket->isLocked() ? KDialog::makeStandardCaption(i18n("%1 (Locked)"))
	                                                 : KDialog::makeStandardCaption(     "%1")          )
	                            .arg(Tools::textToHTMLWithoutP(basket->basketName()));

	QToolTip::add(this, tip);
}
Exemple #5
0
int main() 
{
	Basket bQuote;
	for (int i = 0; i != 10; ++i)
	{
		bQuote.add_item(Bulk_quote("book", i * 10.1, 10, 0.3));
	}
	
	std::cout << std::endl << std::endl;
	std::cout << bQuote.total() << std::endl;
	return 0;
}
Exemple #6
0
TEST(CxxCaseQuote, MockQuote)
{
  using namespace case_quote;

  // Quote sales which has no discount, 45*3 = 135
  std::shared_ptr<MockQuote> q1(new MockQuote("123", 45));
  std::shared_ptr<MockQuote> q2(new MockQuote("123", 45));
  std::shared_ptr<MockQuote> q3(new MockQuote("123", 45));

  EXPECT_CALL(*q1, net_price(_))
    .WillOnce(Return(135));

  // when expects that net_price() gets called on q2 and q3 since net_price()
  // will be called once.
  //
  // .cpp:169: Failure
  // Actual function call count doesn't match EXPECT_CALL(*q3, net_price(_))...
  //          Expected: to be called once
  //            Actual: never called - unsatisfied and active
  // t_ex_basket.cpp:166: Failure
  // Actual function call count doesn't match EXPECT_CALL(*q2, net_price(_))...
  //          Expected: to be called once
  //            Actual: never called - unsatisfied and active
  // [  FAILED  ] BasketTest.checkTotal1 (2 ms)
  //
  // EXPECT_CALL(*q2, net_price(_))
  //     .WillOnce(Return(135));
  //
  // EXPECT_CALL(*q3, net_price(_))
  //     .WillOnce(Return(135));
 
  // so change "Times" or comment them out
  //
  // EXPECT_CALL(*q2, net_price(_))
  //   .Times(AnyNumber())
  //   .WillOnce(Return(135));
  //
  // EXPECT_CALL(*q3, net_price(_))
  //   .Times(AnyNumber())
  //   .WillOnce(Return(135));

  Basket sale;

  sale.add_item(q1);
  sale.add_item(q2);
  sale.add_item(q3);

  EXPECT_EQ(sale.total_receipt(cout), 135); 
}
Exemple #7
0
	void AddItemsToBasket(const std::string& items, Basket& basket)
	{
		for (auto c : items) {
			auto item = std::string(1, c); 
			basket.Add(item);
		}
	}
Exemple #8
0
TEST(CxxCaseQuote, Clone)
{
  using namespace case_quote_clone;

  Basket sale;

  // Quote sales which has no discount. 45*3 = 135
  sale.add_item(Quote("123", 45));
  sale.add_item(Quote("123", 45));
  sale.add_item(Quote("123", 45));

  // minimum 3 and 15% discount. no discount 45*2 = 90
  sale.add_item(Bulk_Quote("345", 45, 3, .15));
  sale.add_item(Bulk_Quote("345", 45, 3, .15));

  sale.total_receipt(cout);
}
Exemple #9
0
int main()
{
	Basket basket;
	Sales_item item1(Bulk_item("0-0001-0001-1", 99, 20, 0.5));
	Sales_item item2(Bulk_item("0-0001-0001-2", 50));
	Sales_item item3(Bulk_item("0-0001-0001-3", 59, 200, 0.3));
	Sales_item item4(Bulk_item("0-0001-0001-1", 99, 20, 0.2));

	basket.add_item(item1);
	basket.add_item(item2);
	basket.add_item(item3);
	basket.add_item(item4);

	cout << basket.total() << endl;
	system("pause");
	return 0;
}
Exemple #10
0
int main()
{
	RawString rawString;
	ForThroughCollection forThrough;
	LambdaMaxFunction lambdaMax;
	Basket basket = {"jab³ko", "sliwka", "pomarañcza"};
	basket.addItems({"banan", "marchew"});
	cout << "Silnia z 10 to: " << TemplateFactorial<1, 10>::value << endl << endl;
	LiteralOperatorExample apostropheOperator;
	TupleExample tupleExample;
	VariadicSizeofExample variadicSizeofExample;
	VariadicVarargsExample varargsExample;
	Bind bind;
	//Regex regex;
    TagDispatcher dispatcher;

	return 0;
}
Exemple #11
0
int main()
{
    Basket basket;

    for (unsigned i = 0; i != 10; ++i)
        basket.add_item(Bulk_quote("Bible",20.6,20,0.3));

    for (unsigned i = 0; i != 10; ++i)
        basket.add_item(Bulk_quote("C++Primer",30.9,5,0.4));

    for (unsigned i = 0; i != 10; ++i)
        basket.add_item(Quote("CLRS",40.1));

    std::ofstream log("log.txt",std::ios_base::app|std::ios_base::out);

    basket.total_receipt(log);
    return 0;
}
Exemple #12
0
 // Deserializing the basket from the binary file in the already existing basket
 // If there is an error, the existing basket is not changed
bool Basket::deserialize(const char* file)
{
	Basket d;
	cout << "Iniating deserialization." << endl;

	std::ifstream myfile(file, std::ios::binary);
	if (!myfile)
	{
		cout << "Error" << endl;
		return false;
	}
	
	int amountOfE;
	myfile.read((char*)&amountOfE, sizeof(amountOfE));
	if (!myfile)
	{
		cout << "Error." << endl;
		return false;
	}

	char buffer[1000];
	int basketNameLen=0;
	myfile.read((char*)&basketNameLen, sizeof(basketNameLen));
	myfile.read((char*)buffer, basketNameLen);
	name[basketNameLen] = '\0';
	d.setName(buffer);

	for (int i = 0; i < amountOfE; i++)
	{
		double eggSize = 0;
		myfile.read((char*)&eggSize, sizeof(eggSize));

		int nameSize = 0;
		myfile.read((char*)&nameSize, sizeof(nameSize));
		myfile.read((char*)buffer, nameSize);
		buffer[nameSize] = '\0';
		d.addÅgg(Egg(buffer, eggSize));
	}
	//if all is okay, existing basket = basket we just read from the binary file
	*this = d;
	myfile.close();
	return true;
}
Exemple #13
0
void SystemTray::updateToolTip()
{
//	return; /////////////////////////////////////////////////////

	Basket *basket = Global::bnpView->currentBasket();
	if (!basket)
		return;

	if (basket->icon().isEmpty() || basket->icon() == "basket" || ! Settings::showIconInSystray())
		setPixmap(basket->isLocked() ? m_lockedIconPixmap : m_iconPixmap);
	else {
		// Code that comes from JuK:
		QPixmap bgPix = loadIcon("basket");
		QPixmap fgPix = SmallIcon(basket->icon());

		QImage bgImage = bgPix.convertToImage(); // Probably 22x22
		QImage fgImage = fgPix.convertToImage(); // Should be 16x16
		QImage lockOverlayImage = loadIcon("lockoverlay").convertToImage();

		KIconEffect::semiTransparent(bgImage);
		copyImage(bgImage, fgImage, (bgImage.width() - fgImage.width()) / 2,
                  (bgImage.height() - fgImage.height()) / 2);
		if (basket->isLocked())
			KIconEffect::overlay(bgImage, lockOverlayImage);

		bgPix.convertFromImage(bgImage);
		setPixmap(bgPix);
	}

	//QTimer::singleShot( Container::c_delayTooltipTime, this, SLOT(updateToolTipDelayed()) );
	// No need to delay: it's be called when notes are changed:
	updateToolTipDelayed();
}
Exemple #14
0
int main()
{
	
	Basket car;
	car.add_items(Quote("0001", 25));
	car.add_items(Bulk_quote("0002", 12, 8, 0.3));
	car.add_items(Quote("0003", 19));
	car.add_items(Bulk_quote("0004", 32, 12, 0.5));
	auto total = car.total_receipt(std::cout);

	return 0;
}
Exemple #15
0
/** Updates the icon and tooltip in the system tray */
void SystemTray::updateDisplay()
{
    Basket *basket = Global::bnpView->currentBasket();
    if (!basket)
        return;

    // Update the icon
    if (basket->icon().isEmpty()
        || basket->icon() == "basket"
        || !Settings::showIconInSystray())
        setIcon(basket->isLocked() ? m_lockedIcon : m_icon);
    else {
        // Code that comes from JuK:
        QPixmap bgPix = loadIcon("basket").pixmap(m_iconSize);
        int smallIconSize = kapp->style()->pixelMetric(QStyle::PM_SmallIconSize);
        QPixmap fgPix = loadIcon(basket->icon()).pixmap(smallIconSize);

        QImage bgImage = bgPix.toImage(); // Probably 22x22
        QImage fgImage = fgPix.toImage(); // Should be 16x16

        KIconEffect::semiTransparent(bgImage);
        copyImage(bgImage, fgImage, bgImage.width()-fgImage.width() / 2,
                  bgImage.height()-fgImage.height() / 2);

        if (basket->isLocked()) {
            QImage lockOverlay = loadIcon("lockoverlay").pixmap(m_iconSize).toImage();
            KIconEffect::overlay(bgImage, lockOverlay);
        }

        setIcon(QPixmap::fromImage(bgImage));
    }
    // update the tooltip
    QString tip = "<p><nobr>";
    QString basketName = "%1";
    if (basket->isLocked())
        basketName += i18n(" (Locked)");
    tip += KDialog::makeStandardCaption(basketName);
    tip = tip.arg(Tools::textToHTMLWithoutP(basket->basketName()));
    setToolTip(tip);
}
Exemple #16
0
bool ThrowItemsToBasket(Basket& basket)
{
    std::vector<Item> ret;
    std::ifstream fin("./input/itemlist/input1.txt", std::ios::in);
    while (!fin.eof())
    {
        std::string line;
        std::getline(fin, line);
        //if (!IsLegal(line)) continue;
        
        std::string item_name;
        unsigned int item_count;
        unsigned int item_price;
        bool is_imported = false;
        
        if (GetItemProperties(line, item_name, item_count, item_price, is_imported))
        {
            Item item(item_name, item_price, is_imported);
            basket.addItem(item, item_count);
        }
    }
    return true;
}
Exemple #17
0
bool operator<(const Basket &a, const Basket &b)
{
	int min;
	if (a.getSize() < b.getSize())
		min = a.getSize();
	else
		min = b.getSize();

	for (int i = 0; i < min; i++)
	{
		if ((strcmp(a[i].getName(), b[i].getName()) > 0)) 
			return false;
	} 

	if(a.getSize() <= b.getSize()) 
	{ 
		return true;
	}
	else
	{
		return false;
	}
}
int main()
{
	Sales_item item1(Item_base("123", 45));
	Sales_item item2(Bulk_item("345", 45, 3, .15));
	Sales_item item3(Bulk_item("678", 55, 5, .25));
	Sales_item item4(Lim_item("abc", 35, 2, .10));
	Sales_item item5(Item_base("def", 35));

	Basket sale;
	sale.add_item(item1);
cout << "added first item" << endl;
	sale.add_item(item1);
	sale.add_item(item1);
	sale.add_item(item1);
	sale.add_item(item2);
	sale.add_item(item2);
	sale.add_item(item2);
	sale.add_item(item2);
	sale.add_item(item2);
	sale.add_item(item2);
	sale.add_item(item2);
	sale.add_item(item2);
	sale.add_item(item3);
	sale.add_item(item3);
	sale.add_item(item3);
	sale.add_item(item3);
	sale.add_item(item3);
	sale.add_item(item3);
	sale.add_item(item3);
	sale.add_item(item3);
	sale.add_item(item4);
	sale.add_item(item4);
	sale.add_item(item4);
	sale.add_item(item4);
	sale.add_item(item4);
	sale.add_item(item4);
	sale.add_item(item5);
	sale.add_item(item5);
cout << "added last item" << endl;

	sale.display(cout);
	cout << sale.total() << endl;
{
	// arguments are the isbn, price, minimum quantity, and discount
	Bulk_item bulk("0-201-82470-1", 50, 5, .19);
	Basket sale;
	sale.add_item(Bulk_item("0-201-82470-1", 50, 5, .19));
	sale.add_item(Bulk_item("0-201-82470-1", 50, 5, .19));
	sale.add_item(Bulk_item("0-201-82470-1", 50, 5, .19));
	sale.add_item(Bulk_item("0-201-82470-1", 50, 5, .19));
	sale.add_item(Bulk_item("0-201-82470-1", 50, 5, .19));
	sale.add_item(Lim_item("0-201-54848-8", 35, 2, .10));
	sale.add_item(Lim_item("0-201-54848-8", 35, 2, .10));
	sale.add_item(Lim_item("0-201-54848-8", 35, 2, .10));
	double total = sale.total();
	cout << "Total Sale: " << total << endl;
}
}
Exemple #19
0
Basket* Basket::createBasket(bool empty) {
    Basket* newBasket = Basket::create();
    newBasket->init();

    return newBasket;
}
Exemple #20
0
int main()
{
	Basket sale;
	sale.add_item(shared_ptr<Quote>(new Quote("123", 45)));
	sale.add_item(shared_ptr<Quote>(new Quote("123", 45)));
	sale.add_item(shared_ptr<Quote>(new Quote("123", 45)));
	sale.add_item(make_shared<Bulk_quote>("345", 45, 3, .15));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("345", 45, 3, .15)));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("345", 45, 3, .15)));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("345", 45, 3, .15)));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("345", 45, 3, .15)));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("345", 45, 3, .15)));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("345", 45, 3, .15)));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("345", 45, 3, .15)));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("678", 55, 5, .25)));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("678", 55, 5, .25)));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("678", 55, 5, .25)));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("678", 55, 5, .25)));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("678", 55, 5, .25)));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("678", 55, 5, .25)));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("678", 55, 5, .25)));
	sale.add_item(shared_ptr<Quote>(new Bulk_quote("678", 55, 5, .25)));
	sale.add_item(shared_ptr<Quote>(new Lim_quote("abc", 35, 2, .10)));
	sale.add_item(shared_ptr<Quote>(new Lim_quote("abc", 35, 2, .10)));
	sale.add_item(shared_ptr<Quote>(new Lim_quote("abc", 35, 2, .10)));
	sale.add_item(shared_ptr<Quote>(new Lim_quote("abc", 35, 2, .10)));
	sale.add_item(shared_ptr<Quote>(new Lim_quote("abc", 35, 2, .10)));
	sale.add_item(shared_ptr<Quote>(new Lim_quote("abc", 35, 2, .10)));
	sale.add_item(shared_ptr<Quote>(new Quote("def", 35)));
	sale.add_item(shared_ptr<Quote>(new Quote("def", 35)));

	sale.total_receipt(cout);

	Basket bsk;
	// arguments are the ISBN, price, minimum quantity, and discount
	bsk.add_item(shared_ptr<Quote>(new Bulk_quote("0-201-82470-1", 50, 5, .19)));
	bsk.add_item(shared_ptr<Quote>(new Bulk_quote("0-201-82470-1", 50, 5, .19)));
	bsk.add_item(shared_ptr<Quote>(new Bulk_quote("0-201-82470-1", 50, 5, .19)));
	bsk.add_item(shared_ptr<Quote>(new Bulk_quote("0-201-82470-1", 50, 5, .19)));
	bsk.add_item(shared_ptr<Quote>(new Bulk_quote("0-201-82470-1", 50, 5, .19)));
	bsk.add_item(shared_ptr<Quote>(new Lim_quote("0-201-54848-8", 35, 2, .10)));
	bsk.add_item(shared_ptr<Quote>(new Lim_quote("0-201-54848-8", 35, 2, .10)));
	bsk.add_item(shared_ptr<Quote>(new Lim_quote("0-201-54848-8", 35, 2, .10)));
	bsk.total_receipt(cout);


}
Exemple #21
0
void Archive::save(Basket *basket, bool withSubBaskets, const QString &destination)
{
	QDir dir;
	KProgressDialog dialog(0, i18n("Save as Basket Archive"), i18n("Saving as basket archive. Please wait..."), /*Not modal, for password dialogs!*/false);
	dialog.showCancelButton(false);
	dialog.setAutoClose(true);
	dialog.show();
	QProgressBar *progress = dialog.progressBar();
    
    progress->setRange(0,/*Preparation:*/1 + /*Finishing:*/1 + /*Basket:*/1 + /*SubBaskets:*/(withSubBaskets ? Global::bnpView->basketCount(Global::bnpView->listViewItemForBasket(basket)) : 0));
	progress->setValue(0);

	// Create the temporary folder:
	QString tempFolder = Global::savesFolder() + "temp-archive/";
	dir.mkdir(tempFolder);

	// Create the temporary archive file:
	QString tempDestination = tempFolder + "temp-archive.tar.gz";
	KTar tar(tempDestination, "application/x-gzip");
	tar.open(QIODevice::WriteOnly);
	tar.writeDir("baskets", "", "");

    progress->setValue(progress->value()+1);        // Preparation finished
    
	kDebug() << "Preparation finished out of " << progress->maximum();

	// Copy the baskets data into the archive:
	QStringList backgrounds;
	Archive::saveBasketToArchive(basket, withSubBaskets, &tar, backgrounds, tempFolder, progress);

	// Create a Small baskets.xml Document:
	QDomDocument document("basketTree");
	QDomElement root = document.createElement("basketTree");
	document.appendChild(root);
	Global::bnpView->saveSubHierarchy(Global::bnpView->listViewItemForBasket(basket), document, root, withSubBaskets);
	Basket::safelySaveToFile(tempFolder + "baskets.xml", "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" + document.toString());
	tar.addLocalFile(tempFolder + "baskets.xml", "baskets/baskets.xml");
	dir.remove(tempFolder + "baskets.xml");

	// Save a Small tags.xml Document:
	QList<Tag*> tags;
	listUsedTags(basket, withSubBaskets, tags);
	Tag::saveTagsTo(tags, tempFolder + "tags.xml");
	tar.addLocalFile(tempFolder + "tags.xml", "tags.xml");
	dir.remove(tempFolder + "tags.xml");

	// Save Tag Emblems (in case they are loaded on a computer that do not have those icons):
	QString tempIconFile = tempFolder + "icon.png";
	for (Tag::List::iterator it = tags.begin(); it != tags.end(); ++it) {
		State::List states = (*it)->states();
		for (State::List::iterator it2 = states.begin(); it2 != states.end(); ++it2) {
			State *state = (*it2);
			QPixmap icon = KIconLoader::global()->loadIcon(
                state->emblem(), KIconLoader::Small, 16, KIconLoader::DefaultState,
                QStringList(), 0L, true
                );
			if (!icon.isNull()) {
				icon.save(tempIconFile, "PNG");
				QString iconFileName = state->emblem().replace('/', '_');
				tar.addLocalFile(tempIconFile, "tag-emblems/" + iconFileName);
			}
		}
	}
	dir.remove(tempIconFile);

	// Finish Tar.Gz Exportation:
	tar.close();

	// Computing the File Preview:
	Basket *previewBasket = basket; // FIXME: Use the first non-empty basket!
	QPixmap previewPixmap(previewBasket->visibleWidth(), previewBasket->visibleHeight());
	QPainter painter(&previewPixmap);
	// Save old state, and make the look clean ("smile, you are filmed!"):
	NoteSelection *selection = previewBasket->selectedNotes();
	previewBasket->unselectAll();
	Note *focusedNote = previewBasket->focusedNote();
	previewBasket->setFocusedNote(0);
	previewBasket->doHoverEffects(0, Note::None);
	// Take the screenshot:
	previewBasket->drawContents(&painter, 0, 0, previewPixmap.width(), previewPixmap.height());
	// Go back to the old look:
	previewBasket->selectSelection(selection);
	previewBasket->setFocusedNote(focusedNote);
	previewBasket->doHoverEffects();
	// End and save our splandid painting:
	painter.end();
	QImage previewImage = previewPixmap.toImage();
	const int PREVIEW_SIZE = 256;
	previewImage = previewImage.scaled(PREVIEW_SIZE, PREVIEW_SIZE, Qt::KeepAspectRatio);
	previewImage.save(tempFolder + "preview.png", "PNG");

	// Finaly Save to the Real Destination file:
	QFile file(destination);
	if (file.open(QIODevice::WriteOnly)) {
		ulong previewSize = QFile(tempFolder + "preview.png").size();
		ulong archiveSize = QFile(tempDestination).size();
		QTextStream stream(&file);
		stream.setCodec("ISO-8859-1");
		stream << "BasKetNP:archive\n"
		       << "version:0.6.1\n"
//		       << "read-compatible:0.6.1\n"
//		       << "write-compatible:0.6.1\n"
		       << "preview*:" << previewSize << "\n";

		stream.flush();
		// Copy the Preview File:
		const unsigned long BUFFER_SIZE = 1024;
		char *buffer = new char[BUFFER_SIZE];
		long sizeRead;
		QFile previewFile(tempFolder + "preview.png");
		if (previewFile.open(QIODevice::ReadOnly)) {
			while ((sizeRead = previewFile.read(buffer, BUFFER_SIZE)) > 0)
				file.write(buffer, sizeRead);
		}
		stream << "archive*:" << archiveSize << "\n";
		stream.flush();

		// Copy the Archive File:
		QFile archiveFile(tempDestination);
		if (archiveFile.open(QIODevice::ReadOnly)) {
			while ((sizeRead = archiveFile.read(buffer, BUFFER_SIZE)) > 0)
				file.write(buffer, sizeRead);
		}
		// Clean Up:
		delete buffer;
		buffer = 0;
		file.close();
	}

    progress->setValue(progress->value()+1); // Finishing finished
	kDebug() << "Finishing finished";

	// Clean Up Everything:
	dir.remove(tempFolder + "preview.png");
	dir.remove(tempDestination);
	dir.rmdir(tempFolder);
}