// ======================================================= WORD CInterface::askRestore(char *szDevice, char *szImageFilename) { /*return newtWinChoice(i18n("Confirmation"), i18n("Yes"), i18n("No"), i18n("Do you really want to restore %s from the image file %s ?"), szDevice, szImageFilename);*/ return msgBoxYesNo(i18n("Confirmation"), i18n("Do you really want to restore %s from the image file %s ?"), szDevice, szImageFilename); }
bool msgBoxCancel(QWidget *parent) { return msgBoxYesNo("Cancelling...", "You may have some unsaved changes; are you sure you want to discard them?"); }
// ============================================================================ WORD CInterface::Error(CExceptions *excep, char *szFilename, char *szDevice/*=NULL*/) { signed int err; DWORD dwArg1 = excep -> get_dwArg1(); DWORD dwArg2 = excep -> get_dwArg2(); //QWORD qwArg1 = excep -> get_qwArg1(); //QWORD qwArg2 = excep -> get_qwArg2(); char * szArg1 = excep -> get_szArg1(); err = excep -> GetExcept(); excep -> setCaught(); if (err >= 0) { msgBoxError(i18n("Error: %s"), strerror(err)); return ERR_QUIT; } switch (err) { case ERR_CANCELED: msgBoxError(i18n("Action canceled as user required")); return ERR_QUIT; case ERR_ERRNO: msgBoxError(i18n("Error: %s"), strerror(dwArg1)); return ERR_QUIT; case ERR_EXIST: if (msgBoxYesNo(i18n("Overwrite image?"), i18n("The %s imagefile already exist. Do you want to overwrite it?"), szFilename) == MSGBOX_NO) return ERR_QUIT; else return ERR_RETRY; case ERR_ACCESS: msgBoxCancel(i18n("Access denied"), i18n("You don't have write access on %s"), szFilename); return ERR_QUIT; case ERR_COMP: msgBoxError(i18n("Invalid compression level for %s"), szFilename); return ERR_QUIT; case ERR_OPENED: msgBoxError(i18n("imagefile %s is already open"), szFilename); return ERR_QUIT; case ERR_EOF: case ERR_NOTFOUND: case ERR_PATH: // no code here return ERR_RETRY; case ERR_VOLUMEHEADER: msgBoxError(i18n("file %s is too short to be a partimage volume: " "can't read header"), szFilename); return ERR_QUIT; /*case ERR_PARTITIONVOLUME: msgBoxError(i18n("file %s is not an partimage volume: " "magic string does not match"), szFilename); return ERR_QUIT;*/ case ERR_WRONGMAGICINVALIMGFILE:// ERR_WRONGMAGIC: msgBoxError(i18n("file %s is not an partimage file: " "magic string does not match"), szFilename); return ERR_QUIT; case ERR_WRONGMAGIC: msgBoxError(i18n("magic string does not match: error in the image file [%s]"), szFilename); return ERR_QUIT; case ERR_VOLUMEID: msgBoxError(i18n("the current volume doesn't fit with current image: " "wrong identificator")); return ERR_QUIT; case ERR_NOMEM: msgBoxError(i18n("Out of memory.")); return ERR_QUIT; case ERR_PASSWD: msgBoxError(i18n("incorrect password or user not in partimagedusers file")); return ERR_QUIT; case ERR_TOOMANY: msgBoxError(i18n("Too many clients connected to partimaged. " "Please, retry later")); return ERR_QUIT; case ERR_BLOCKSIZE: msgBoxError(i18n("Only 4096 bytes per block %s volumes are supported. " "Current one is %lu bytes/block"), szArg1, dwArg1); return ERR_QUIT; case ERR_LOCKED: msgBoxError(i18n("The partition %s id already locked by another" "process. You can't work on it"), szArg1); return ERR_QUIT; case ERR_CHECK_CRC: ErrorCRC(excep->get_qwArg1(), excep->get_qwArg2()); return ERR_QUIT; case ERR_CHECK_NUM: msgBoxError(i18n("Error while checking the data: Invalid block number." "Maybe a volume or some data were skipped.")); return ERR_QUIT; case ERR_VOLUMENUMBER: msgBoxError(i18n("This volume (%ld) is not the expected one: %ld."), dwArg1, dwArg2); return ERR_QUIT; case ERR_HOST: msgBoxError(i18n("Hostname/IP Error!\n" "Perhaps the hostname could not be resolved. " "(Try again using IP address)")); return ERR_RETRY; /* case ERR_SSL_CONNECT: msgBoxError(i18n("Problem with SSL. Ensure partimaged uses SSL")); return ERR_QUIT; case ERR_SSL_CTX: msgBoxError(i18n("Problem with SSL. Contact partimage team for help")); return ERR_QUIT; case ERR_SSL_LOADCERT: msgBoxError( i18n("partimaged got trouble when loading SSL certificate %s"),CERTF); return ERR_QUIT; case ERR_SSL_LOADKEY: msgBoxError( i18n("partimaged got trouble when loading SSL keyfile %s"),CERTF); return ERR_QUIT; case ERR_SSL_PRIVKEY: msgBoxError("%s %s", i18n("SSL error: private key doesn't not match"), i18n("the certificate public key")); return ERR_QUIT; */ case ERR_READ_BITMAP: ErrorReadingBitmap(dwArg1, dwArg2); return ERR_QUIT; case ERR_READING: ErrorReading(dwArg1, dwArg2); return ERR_QUIT; case ERR_WRITING: ErrorWriting(dwArg1, dwArg2); return ERR_QUIT; case ERR_NOMBR: msgBoxError(i18n("No MBR was found in this imagefile. We can't " "continue")); return ERR_QUIT; case ERR_FSCHK: msgBoxError(i18n("Partition checks found error(s) on partitions")); return ERR_QUIT; case ERR_OPENING_DEVICE: ErrorOpeningPartition(szFilename, dwArg1); return ERR_QUIT; case ERR_ENCRYPT: ErrorEncryption(); return ERR_QUIT; case ERR_PART_TOOSMALL: //showDebug(1, "QW1=%llu and 2=%llu\n\n", qwArg1, qwArg2); ErrorTooSmall(excep->get_qwArg1(), excep->get_qwArg2()); return ERR_QUIT; case ERR_FAT_MISMATCH: return ERR_QUIT; case ERR_SAVE_MBR: msgBoxError(i18n("Impossible to read MBR from disk")); return ERR_QUIT; case ERR_WRONG_FS: msgBoxError(i18n("Invalid or damaged filesystem %s"), szDevice); return ERR_QUIT; case ERR_READ_SUPERBLOCK: ErrorReadingSuperblock(dwArg1); return ERR_QUIT; case ERR_ZEROING: msgBoxError(i18n("Impossible to zero the block on harddrive: %s"), strerror(dwArg1)); return ERR_QUIT; case ERR_REFUSED: msgBoxError(i18n("Connection refused by server:" " incompatibles networking options." "Try disabling login option for server with '-L'")); return ERR_QUIT; case ERR_VERSIONSMISMATCH: msgBoxError(i18n("Connection refused by server: versions mismatch")); return ERR_QUIT; case ERR_VERSION_NEWER: msgBoxError(i18n("The image file was created by a newer release (%s)" " of Partition Image. Please update this software and retry."), szArg1); return ERR_QUIT; case ERR_VERSION_OLDER: msgBoxError(i18n("The image file was created by an older release (%s)" " of Partition Image. You must use the old version to restore" "your image or you have to recreate it with current version"), szArg1); return ERR_QUIT; case ERR_NOTAPARTIMAGEFILE: msgBoxError(i18n("%s is not a valid Partition Image file or it's" " damaged. Sorry, can't continue"), szArg1); return ERR_QUIT; case ERR_NOTAREGULARFILE: msgBoxError(i18n("File %s is not a regular file. For security reasons," " we can't continue"), szArg1); return ERR_QUIT; case ERR_AUTOMOUNT: msgBoxError(i18n("Cannot mount %s"), szArg1 /*m_szMountDevice*/); return ERR_QUIT; case ERR_AUTOUMOUNT: msgBoxError(i18n("Cannot unmount %s"), szArg1 /*m_szMountDevice*/); return ERR_QUIT; case ERR_CREATESPACEFILE: msgBoxError(i18n("Cannot create temp file [%s]. Please, check there is space enough and you have access rights."), szArg1); return ERR_QUIT; case ERR_CREATESPACEFILENOSPC: msgBoxError(i18n("Cannot create temp file [%s]. No space left on device."), szArg1); return ERR_QUIT; case ERR_CREATESPACEFILEDENIED: #ifdef MUST_CHEUID msgBoxError(i18n("Cannot create temp file in [%s]. Write access is denied" " for user 'partimag'"), szArg1); #else msgBoxError(i18n("Cannot create temp file in [%s]. Write access is denied."), szArg1); #endif return ERR_QUIT; case ERR_FILETOOLARGE: msgBoxError(i18n("File too large. (larger than 2 GB). Can't continue. This problem can come from the kernel, the glibc, the file system which where the image is written")); return ERR_QUIT; default: msgBoxError(i18n("Unknown error %d -> %s"), err, szFilename); exit(-5); } }