mirror of
				https://git.wownero.com/wowlet/wowlet.git
				synced 2024-08-15 01:03:14 +00:00 
			
		
		
		
	Make format csv import as same as export
This commit is contained in:
		
							parent
							
								
									78516f4546
								
							
						
					
					
						commit
						47d965c6cd
					
				
					 1 changed files with 9 additions and 4 deletions
				
			
		| 
						 | 
					@ -182,12 +182,17 @@ QMap<QString, QString> AddressBookModel::readCSV(const QString &path) {
 | 
				
			||||||
    QString csv = Utils::barrayToString(Utils::fileOpen(path));
 | 
					    QString csv = Utils::barrayToString(Utils::fileOpen(path));
 | 
				
			||||||
    QTextStream stream(&csv);
 | 
					    QTextStream stream(&csv);
 | 
				
			||||||
    QMap<QString, QString> map;
 | 
					    QMap<QString, QString> map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    while(!stream.atEnd()) {
 | 
					    while(!stream.atEnd()) {
 | 
				
			||||||
        QStringList line = stream.readLine().split(",");
 | 
					        QStringList line = stream.readLine().split(",");
 | 
				
			||||||
        QString name = line.at(0);
 | 
					        if(line.length() != 2) {
 | 
				
			||||||
        QString address = line.at(1);
 | 
					            continue;
 | 
				
			||||||
        if(!name.isEmpty() && !address.isEmpty()) {
 | 
					        }
 | 
				
			||||||
            map[name] = address;
 | 
					        QString address = line.at(0);
 | 
				
			||||||
 | 
					        QString description = line.at(1);
 | 
				
			||||||
 | 
					        description = description.replace("\"", "");
 | 
				
			||||||
 | 
					        if(!description.isEmpty() && !address.isEmpty()) {
 | 
				
			||||||
 | 
					            map[description] = address;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return map;
 | 
					    return map;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue